--- old/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/TypeEnter.java 2015-02-23 20:10:47.000000000 +0100 +++ new/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/TypeEnter.java 2015-02-23 20:10:47.000000000 +0100 @@ -36,6 +36,7 @@ import com.sun.tools.javac.code.Scope.NamedImportScope; import com.sun.tools.javac.code.Scope.StarImportScope; import com.sun.tools.javac.code.Scope.WriteableScope; +import com.sun.tools.javac.comp.Annotate.AnnotationTypeMetadata; import com.sun.tools.javac.tree.*; import com.sun.tools.javac.util.*; import com.sun.tools.javac.util.DefinedBy.Api; @@ -135,6 +136,7 @@ lint = Lint.instance(context); typeEnvs = TypeEnvs.instance(context); dependencies = Dependencies.instance(context); + Source source = Source.instance(context); allowTypeAnnos = source.allowTypeAnnotations(); allowDeprecationOnImport = source.allowDeprecationOnImport(); } @@ -164,7 +166,7 @@ Env topEnv = enter.topLevelEnv(tree); finishImports(tree, () -> { completeClass.resolveImports(tree, topEnv); }); } - } + } } /* ******************************************************************** @@ -184,7 +186,7 @@ } try { - annotate.enterStart(); + enter.enterStart(); sym.flags_field |= UNATTRIBUTED; List> queue; @@ -206,7 +208,7 @@ } } } finally { - annotate.enterDone(); + enter.enterDone(); } } @@ -784,9 +786,9 @@ Env baseEnv = baseEnv(tree, env); if (tree.extending != null) - annotate.annotateTypeLater(tree.extending, baseEnv, sym, tree.pos()); + annotate.queueScanTreeAndTypeAnnotate(tree.extending, baseEnv, sym, tree.pos()); for (JCExpression impl : tree.implementing) - annotate.annotateTypeLater(impl, baseEnv, sym, tree.pos()); + annotate.queueScanTreeAndTypeAnnotate(impl, baseEnv, sym, tree.pos()); annotate.flush(); attribSuperTypes(env, baseEnv); @@ -804,7 +806,7 @@ attr.attribTypeVariables(tree.typarams, baseEnv); for (JCTypeParameter tp : tree.typarams) - annotate.annotateTypeLater(tp, baseEnv, sym, tree.pos()); + annotate.queueScanTreeAndTypeAnnotate(tp, baseEnv, sym, tree.pos()); // check that no package exists with same fully qualified name, // but admit classes in the unnamed package which have the same @@ -903,6 +905,11 @@ addEnumMembers(tree, env); } memberEnter.memberEnter(tree.defs, env); + + if (tree.sym.isAnnotationType()) { + Assert.checkNull(tree.sym.completer); + tree.sym.setAnnotationTypeMetadata(new AnnotationTypeMetadata(tree.sym, annotate.annotationTypeSourceCompleter())); + } } /** Add the implicit members for an enum type