some new bugs

Steve Sides steve.sides at oracle.com
Fri Feb 22 18:14:27 PST 2013


yep.

  I had entered an earlier one,
8008182 <http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=8008182> - 
Repeated type-annotation on type arg in method reference not written to 
class file
and I'm wondering is that last one is related.

-steve

On 2/22/2013 6:09 PM, Werner Dietl wrote:
> Thanks for these tests!
> I'll work on fixing them in the type-annotations repository ASAP.
>
> cu, WMD.
>
> On Fri, Feb 22, 2013 at 6:07 PM, Steve Sides<steve.sides at oracle.com>  wrote:
>> Hi Werner,
>> I have been looking at type-annotations in anonymous and inner classes.
>> I have a few new bugs. They are showing yet in bugs.sun.com, but they should
>> by tomorrow(?).
>> Only the first one is a jtreg test. The other 2 are part of a larger test
>> with some classfile checking, but I
>> put the sample code here so you can javac,javap it.
>>
>> -steve
>>
>> 8008751 - Type Annotation on array level in nested class of anonymous class
>> results in NPE at
>> com.sun.tools.javac.code.TypeAnnotations$TypeAnnotationPositions.resolveFrame(TypeAnnotations.java:792)
>> 8<- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
>> - - - - - - - -
>> /*
>>   * @test
>>   * @summary type-annotation on array level in nested class results in NPE
>>   * @bug 8008751
>>   */
>> import java.lang.annotation.*;
>> import static java.lang.annotation.RetentionPolicy.*;
>> import static java.lang.annotation.ElementType.*;
>> import java.util.List;
>>
>> class T8008751 {
>>      Object mtest( T8008751 t){ return null;  }
>>      Object mmtest( T8008751 t){ return null;  }
>>      public void test() {
>>         mtest( new T8008751() {
>>                  class InnerAnon {
>>                      @A("ok") String s = (@A("ok") String)( new @A("ok")
>> Object());
>>                      @A("ok") Object @A("NPE")[] [] ia_sa1 = null;
>>                  }
>>                  // If not instanciated, no crash.
>>                  InnerAnon IA = new InnerAnon();
>>             });
>>     }
>> }
>> @Retention(RUNTIME) @Target(TYPE_USE)  @interface A { String value(); }
>>
>>
>> 8008762 - Type annotation on inner class in anonymous class show up as
>> regular type annotations
>> 8<- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
>> - - - - - - - -
>> import java.lang.annotation.*;
>> import static java.lang.annotation.RetentionPolicy.*;
>> import static java.lang.annotation.ElementType.*;
>>
>> class Test1 { // Test1.class
>>      @A @B String data = "test";
>>      @A @B String m(){ return null; };
>>      Object mtest( Test1 t){ return null; }
>>      public void test() {
>>          mtest( new Test1() { // Test1$1.class
>>                  @A @B String a_data = "test";
>>                  @A @B String a_m(){ return null; };
>>                  class InnerAnon { // Test1$1$InnerAnon.class
>>                       @A @B String ai_data = "test";
>>                       @A @B String ai_m(){ return null; };
>>                  }
>>                   InnerAnon IA = new InnerAnon();
>>             });
>>     }
>> }
>>
>> @Retention(RUNTIME) @Target(TYPE_USE) @interface A { }
>> @Retention(CLASS) @Target(TYPE_USE) @interface B { }
>>
>>
>> 8008769 - Repeated type-annotations on type parameter of local variable are
>> not written to classfile.
>> 8<- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
>> - - - - - - - -
>> import java.lang.annotation.*;
>> import static java.lang.annotation.RetentionPolicy.*;
>> import static java.lang.annotation.ElementType.*;
>>
>> class Test<T>  {
>>      Test<@A @A @A String>  t = new Test<>(); //ok
>>
>>      public void test() {
>>          Test<@B String>  t1 = new Test<>(); //ok
>>          Test<@A @A @A String>  t2 = new Test<>(); //not ok
>>     }
>> }
>>
>> @Target(TYPE_USE) @Repeatable( AC.class ) @interface A { }
>> @Target(TYPE_USE) @interface AC { A[] value(); }
>> @Target(TYPE_USE) @Repeatable( BC.class ) @interface B { }
>> @Target(TYPE_USE) @interface BC { B[] value(); }
>>
>>
>
>

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.openjdk.java.net/pipermail/type-annotations-dev/attachments/20130222/50d71c4b/attachment.html 


More information about the type-annotations-dev mailing list