Extra calls to annotate.flush()

Joel Borggrén-Franck joel.franck at oracle.com
Wed Oct 2 10:19:52 PDT 2013


Hi Werner and others,

I noticed that 2 extra calls in MemberEnter to annotate.flush() were introduced with the first type annotation checkin:

src/share/classes/com/sun/tools/javac/comp/MemberEnter.java
692-        annotateLater(tree.mods.annotations, localEnv, v, tree.pos());
693-        typeAnnotate(tree.vartype, env, v, tree.pos());
694:        annotate.flush();
695-        v.pos = tree.pos;
696-    }

1011-            for (JCExpression impl : tree.implementing)
1012-                typeAnnotate(impl, baseEnv, sym, tree.pos());
1013:            annotate.flush();
1014-
1015-            // Determine supertype.

1080-            for (JCTypeParameter tp : tree.typarams)
1081-                typeAnnotate(tp, baseEnv, sym, tree.pos());
1082:            annotate.flush();
1083-
1084-            // Add default constructor if needed.

Previously there were just one at the end of complete:

langtools jbf$ ag -B 2 -A 2 "annotate.flush()" src/
src/share/classes/com/sun/tools/javac/comp/MemberEnter.java
1053-
1054-            // commit pending annotations
1055:            annotate.flush();
1056-        }
1057-    }

The fact that there are two in complete() seem unnecessary but isn't causing to much harm that I know of, but the extra one in visitVarDef is causing trouble.

Overall there seems to be a lot of extra calls to flush in type anno code, 6 extra added in the first merge from the type anno repo to tl:

hg log -p -r 1519 | ag annotate.flush
+                annotate.flush();
                 annotate.flush();
+                annotate.flush();
+            annotate.flush();
+        annotate.flush();
+            annotate.flush();
+            annotate.flush();
-            annotate.flush();

Do you know why so many were added?

cheers
/Joel


More information about the type-annotations-dev mailing list