8036142: Remove redundant call to annotateTypeLater with null Symbol
authoremc
Mon, 03 Mar 2014 16:17:32 -0500
changeset 23134 010b1b0d25fb
parent 23133 a58476887b3d
child 23135 3c45d467788f
8036142: Remove redundant call to annotateTypeLater with null Symbol Summary: annotateTypeLater (formerly typeAnnotate) with null as the symbol was a way to force attribution of type annotations, but this is now obsolete and problematic, and a silent noop condition Reviewed-by: jjg
langtools/src/share/classes/com/sun/tools/javac/comp/Annotate.java
langtools/src/share/classes/com/sun/tools/javac/comp/Attr.java
--- a/langtools/src/share/classes/com/sun/tools/javac/comp/Annotate.java	Fri Feb 28 20:25:24 2014 +0100
+++ b/langtools/src/share/classes/com/sun/tools/javac/comp/Annotate.java	Mon Mar 03 16:17:32 2014 -0500
@@ -842,7 +842,7 @@
                                   final Env<AttrContext> env,
                                   final Symbol sym,
                                   final DiagnosticPosition deferPos) {
-
+        Assert.checkNonNull(sym);
         normal(new Annotate.Worker() {
                 @Override
                 public String toString() {
--- a/langtools/src/share/classes/com/sun/tools/javac/comp/Attr.java	Fri Feb 28 20:25:24 2014 +0100
+++ b/langtools/src/share/classes/com/sun/tools/javac/comp/Attr.java	Mon Mar 03 16:17:32 2014 -0500
@@ -769,13 +769,6 @@
                 = deferredLintHandler.setPos(variable.pos());
 
         try {
-            // Use null as symbol to not attach the type annotation to any symbol.
-            // The initializer will later also be visited and then we'll attach
-            // to the symbol.
-            // This prevents having multiple type annotations, just because of
-            // lazy constant value evaluation.
-            annotate.annotateTypeLater(variable.init, env, null, variable.pos());
-            annotate.flush();
             Type itype = attribExpr(variable.init, env, type);
             if (itype.constValue() != null) {
                 return coerce(itype, type).constValue();