tests for "strange behavior"
Steve Sides
steve.sides at oracle.com
Tue Apr 23 12:08:08 PDT 2013
Hi Werner,
A little while ago you mention some strange behavior where type
annotations were not being written to the classfile.
I have a test for that, a smaller specific one and a larger one covering
more test cases, http://cr.openjdk.java.net/~ssides/8013065/
The regression test covers the basic issue that when the inner class (in
anonymous class) is instanciated the type-annotations are written as
annotations rather than as type annotations.
class Test<T> {
Object mtest( Test<T> t){ return null; }
public void test() {
mtest( new Test<T>() {
class InnerAnon<U> {
@A @B String ia_m1(){ return null; };
}
//comment below and they're written correctly.
InnerAnon<String> IA = new InnerAnon< String>();
});
}
}
@Retention(CLASS) @Target(TYPE_USE) @interface A { }
@Retention(RUNTIME) @Target(TYPE_USE) @interface B { }
It's even a little stranger in that @A and @B aren't those "silly
annotations" with type and decl targets, only TYPE_USE.
The larger case coverage more test cases but the issue seems the same,
too few type annotations and too many annotations.
For now, the larger case as is does not run the repeated annotation
scenarios:
59 Boolean [][] bRepeat = new Boolean[][]{
60 /* no repeats */ {false, false, false, false, false, false}
61 /* repeat A,C,TA */ //{true, false, true, false, true, false}
62 /* repeat B,D,TB {false, true, false, true, false, true}, */
63 /* repeat all {true, true, true, true, true, true}*/
only the non-repeated ones. However, as is, it might be helpful in
testing the fix for this.
-steve
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.openjdk.java.net/pipermail/type-annotations-dev/attachments/20130423/c49ed73d/attachment.html
More information about the type-annotations-dev
mailing list