type-annotations in inner in anonymous class

Werner Dietl wdietl at gmail.com
Mon Apr 8 15:03:21 PDT 2013


Hi Steve,

thanks for confirming that some bugs are fixed.
The one you notice is related to my previous question:

http://mail.openjdk.java.net/pipermail/type-annotations-dev/2013-April/000777.html

In some cases declaration annotations are stored instead of type
annotations. I see the strange behavior only if there is a field of
type InnerAnon.
Any comments would be appreciated.

cu, WMD.


On Mon, Apr 8, 2013 at 2:32 PM, Steve Sides <steve.sides at oracle.com> wrote:
> Hi Werner,
> I have a build of the latest type-annotations compiler. The crash bug(s) are
> fixed and it all compiles and runs(yeah!).  After verifying my expected
> valures, I will be able to put back a last test using inner and anonymous
> classes. In the meantime, I see in the case below that no type annotations
> are attributed to the methods and fields in InnerAnon, only
> Runtime(In)VisibleAnnotations.  The cases for inner, local and anonymous
> classes are okay, but the inner class in an anonymous class (not sure how
> likely that is, but here it is) are failing.
>
> -steve
>
> import java.lang.annotation.*;
> import static java.lang.annotation.RetentionPolicy.*;
> import static java.lang.annotation.ElementType.*;
>
> class Test1IA<T> {
>     Object mtest( Test1IA<T> t){ return null;  }
>     public void test() {
>         mtest( new Test1IA<T>() {
>                 class InnerAnon<U> { // TestN$1$InnerAnon.class
>                     @A @B @C @D  String ia_odata1 = "test";
>                     @A @B @C @D  int    ia_pdata1 = 0;
>                     @A @B @C @D  U      ia_udata = null;
>                     @A @B @C @D  Object [][] ia_sa1 = null;
>                     @TA @TB @C @D  T    ia_tdata = null;
>                     @A @B @C @D  String ia_m1(){ return null; };
>                     @A @B @C @D  int    ia_m2(@A @B @C @D  Object o){return
> 0;}
>                     @A @B @C @D
> <@TA @TB @C @D  U> Object ia_um(@A @B @C @D   U u) { return null; }
>                 }
>                 InnerAnon<String> IA = new InnerAnon< String>();
>            });
>    }
> }
>
> @Retention(RUNTIME) @Target({TYPE_USE,FIELD})  @Repeatable( AC.class )
> @interface A { }
> @Retention(RUNTIME) @Target({TYPE_USE,METHOD}) @Repeatable( BC.class )
> @interface B { }
> @Retention(RUNTIME) @Target({TYPE_USE,FIELD})  @interface AC { A[] value();
> }
> @Retention(RUNTIME) @Target({TYPE_USE,METHOD}) @interface BC { B[] value();
> }
>
> @Retention(CLASS)   @Target({TYPE_USE,FIELD})  @Repeatable( CC.class )
> @interface C { }
> @Retention(CLASS)   @Target({TYPE_USE,METHOD}) @Repeatable( DC.class )
> @interface D { }
> @Retention(CLASS)   @Target({TYPE_USE,FIELD})  @interface CC { C[] value();
> }
> @Retention(CLASS)   @Target({TYPE_USE,METHOD}) @interface DC { D[] value();
> }
>
> @Retention(RUNTIME) @Target({TYPE_USE,TYPE_PARAMETER,FIELD})  @Repeatable(
> TAC.class ) @interface TA { }
> @Retention(RUNTIME) @Target({TYPE_USE,TYPE_PARAMETER,METHOD}) @Repeatable(
> TBC.class ) @interface TB { }
> @Retention(RUNTIME) @Target({TYPE_USE,TYPE_PARAMETER,FIELD})  @interface TAC
> { TA[] value(); }
> @Retention(RUNTIME) @Target({TYPE_USE,TYPE_PARAMETER,METHOD}) @interface TBC
> { TB[] value(); }
>
>



-- 
http://www.google.com/profiles/wdietl


More information about the type-annotations-dev mailing list