changeset 2206:5d5488d2ce00

Prevent entering type annotations twice by visiting trees only on the right symbol. Clean up the organizeTypeAnnotationsSignatures interface.
author wmdietl
date Sun, 17 Feb 2013 19:25:06 -0800
parents 6182a906cba1
children b832dc269136
files src/share/classes/com/sun/tools/javac/comp/MemberEnter.java
diffstat 1 files changed, 21 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/src/share/classes/com/sun/tools/javac/comp/MemberEnter.java	Sun Feb 17 19:23:14 2013 -0800
+++ b/src/share/classes/com/sun/tools/javac/comp/MemberEnter.java	Sun Feb 17 19:25:06 2013 -0800
@@ -1087,7 +1087,7 @@
                 isFirst = true;
             }
         }
-        annotate.afterRepeated(TypeAnnotations.organizeTypeAnnotationsSignatures(syms, names, log, tree));
+        TypeAnnotations.organizeTypeAnnotationsSignatures(syms, names, log, tree, annotate);
     }
 
     private void actualEnterTypeAnnotations(final List<JCAnnotation> annotations,
@@ -1197,6 +1197,26 @@
             // Do not annotate the body, just the signature.
             // scan(tree.body);
         }
+
+        @Override
+        public void visitVarDef(final JCVariableDecl tree) {
+            if (sym.kind == Kinds.VAR) {
+                // Don't visit a parameter once when the sym is the method
+                // and once when the sym is the parameter.
+                scan(tree.mods);
+                scan(tree.vartype);
+            }
+            scan(tree.init);
+        }
+
+        @Override
+        public void visitNewClass(JCNewClass tree) {
+            if (tree.def == null) {
+                // For an anonymous class instantiation the class
+                // will be visited separately.
+                super.visitNewClass(tree);
+            }
+        }
     }