changeset 3229:c96d2c7acfe6

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
author emc
date Mon, 03 Mar 2014 16:17:32 -0500
parents d2d04222e191
children 96ebdbb37e6d
files src/share/classes/com/sun/tools/javac/comp/Annotate.java src/share/classes/com/sun/tools/javac/comp/Attr.java
diffstat 2 files changed, 1 insertions(+), 8 deletions(-) [+]
line wrap: on
line diff
--- a/src/share/classes/com/sun/tools/javac/comp/Annotate.java	Fri Feb 28 20:25:24 2014 +0100
+++ b/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/src/share/classes/com/sun/tools/javac/comp/Attr.java	Fri Feb 28 20:25:24 2014 +0100
+++ b/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();