Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8037348

RuntimeInvisibleAnnotations should not be generated for type annotation on anonymous innerclass creation

XMLWordPrintable

    • b19
    • Not verified

      Consider this source code:
      ---
      import java.lang.annotation.*;
      public class AnnotCopiedToAnonymous {
           private Object o = new @Annot Object() { };
      }
      @Target({ElementType.TYPE, ElementType.TYPE_USE})
      @interface Annot { }
      ---

      The generated anonymous innerclass (AnnotCopiedToAnonymous$1) has the Annot annotation as a declaration annotation in its RuntimeInvisibleAnnotations in addition to having it in its RuntimeInvisibleTypeAnnotations with a supertype target.

      The annotation should not be listed in the RuntimeInvisibleAnnotations attribute, see:
      http://mail.openjdk.java.net/pipermail/type-annotations-dev/2014-March/001663.html

            jlahoda Jan Lahoda
            jlahoda Jan Lahoda
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

              Created:
              Updated:
              Resolved: