langtools/src/share/classes/com/sun/tools/javac/jvm/ClassReader.java
changeset 14804 f93a8d60b9a4
parent 14725 65836e833f59
child 14949 45f43822bbde
--- a/langtools/src/share/classes/com/sun/tools/javac/jvm/ClassReader.java	Wed Dec 12 20:26:56 2012 +0100
+++ b/langtools/src/share/classes/com/sun/tools/javac/jvm/ClassReader.java	Mon Dec 03 11:16:32 2012 +0100
@@ -1360,6 +1360,16 @@
     void attachAnnotationDefault(final Symbol sym) {
         final MethodSymbol meth = (MethodSymbol)sym; // only on methods
         final Attribute value = readAttributeValue();
+
+        // The default value is set later during annotation. It might
+        // be the case that the Symbol sym is annotated _after_ the
+        // repeating instances that depend on this default value,
+        // because of this we set an interim value that tells us this
+        // element (most likely) has a default.
+        //
+        // Set interim value for now, reset just before we do this
+        // properly at annotate time.
+        meth.defaultValue = value;
         annotate.normal(new AnnotationDefaultCompleter(meth, value));
     }
 
@@ -1680,6 +1690,9 @@
         public void enterAnnotation() {
             JavaFileObject previousClassFile = currentClassFile;
             try {
+                // Reset the interim value set earlier in
+                // attachAnnotationDefault().
+                sym.defaultValue = null;
                 currentClassFile = classFile;
                 sym.defaultValue = deproxy(sym.type.getReturnType(), value);
             } finally {