src/share/classes/com/sun/tools/javac/jvm/ClassReader.java

changeset 1445
376d6c1b49e5
parent 1436
f6f1fd261f57
child 1452
de1ec6fc93fe
     1.1 --- a/src/share/classes/com/sun/tools/javac/jvm/ClassReader.java	Wed Dec 12 20:26:56 2012 +0100
     1.2 +++ b/src/share/classes/com/sun/tools/javac/jvm/ClassReader.java	Mon Dec 03 11:16:32 2012 +0100
     1.3 @@ -1360,6 +1360,16 @@
     1.4      void attachAnnotationDefault(final Symbol sym) {
     1.5          final MethodSymbol meth = (MethodSymbol)sym; // only on methods
     1.6          final Attribute value = readAttributeValue();
     1.7 +
     1.8 +        // The default value is set later during annotation. It might
     1.9 +        // be the case that the Symbol sym is annotated _after_ the
    1.10 +        // repeating instances that depend on this default value,
    1.11 +        // because of this we set an interim value that tells us this
    1.12 +        // element (most likely) has a default.
    1.13 +        //
    1.14 +        // Set interim value for now, reset just before we do this
    1.15 +        // properly at annotate time.
    1.16 +        meth.defaultValue = value;
    1.17          annotate.normal(new AnnotationDefaultCompleter(meth, value));
    1.18      }
    1.19  
    1.20 @@ -1680,6 +1690,9 @@
    1.21          public void enterAnnotation() {
    1.22              JavaFileObject previousClassFile = currentClassFile;
    1.23              try {
    1.24 +                // Reset the interim value set earlier in
    1.25 +                // attachAnnotationDefault().
    1.26 +                sym.defaultValue = null;
    1.27                  currentClassFile = classFile;
    1.28                  sym.defaultValue = deproxy(sym.type.getReturnType(), value);
    1.29              } finally {

mercurial