Problem with type annotations on a type parameter
Joel Borggrén-Franck
joel.franck at oracle.com
Wed Apr 24 23:34:14 PDT 2013
Hi,
I just pushed my fix for repeating annotations on type parameters (there was some delay in registering me as a committer).
This problem looks similar, is it fixed if you pull the latest langtools repo?
cheers
/Joel
On Apr 5, 2013, at 3:02 AM, Werner Dietl <wdietl at gmail.com> wrote:
> Jon, Steve, all,
>
> I'm debugging some strange behavior and I would appreciate a quick look by somebody else. I'm probably missing something very obvious.
>
> Take the attached class that contains a class nested within an anonymous class.
> Compile with the type-annotations javac and you'll get this output:
>
> ClassWriter: Position UNKNOWN in type annotation: @TA
> ClassWriter: Position UNKNOWN in type annotation: @TA
>
> That's bad, as it means that the type annotation is not written. We confirm this by running javap:
>
> javap -v NestedTest\$1\$Inner.class
>
> Nothing on the type parameter.
>
> The strange thing is that this works if we remove the declaration of field i1.
> It also works if instead of a method type parameter we declare a method parameter, or a class type parameter, or if the class is outside of the anonymous class.
>
> Does anybody understand the dependency between field i1 and the type parameter X?
>
> Steve: could you expand the tests in tools/javac/annotations/typeAnnotations/referenceinfos/ to ensure that annotations in anonymous classes and lambdas work as expected?
> Please also add a failing test for this.
>
> Thanks,
> cu, WMD.
>
> --
> http://www.google.com/profiles/wdietl
> <NestedTest.java>
More information about the type-annotations-dev
mailing list