Clarification of TYPE Target type and anonymous classes

Eric McCorkle eric.mccorkle at oracle.com
Tue Mar 18 19:01:53 UTC 2014


The regression test suite contains the following test, which is expected
to fail compilation:

import java.lang.annotation.*;

@Retention(RetentionPolicy.RUNTIME)
@Target(ElementType.TYPE)
@interface X {}
interface Foo {}
class TypeOnAnonClass { void m() { new @X Foo() {}; } }


I believe this is incorrect, as the annotation @X should end up as a
class annotation on the anonymous class.  Please clarify what should
happen here.

Thanks,
Eric
-------------- next part --------------
A non-text attachment was scrubbed...
Name: eric_mccorkle.vcf
Type: text/x-vcard
Size: 303 bytes
Desc: not available
URL: <http://mail.openjdk.java.net/pipermail/type-annotations-dev/attachments/20140318/13a50093/eric_mccorkle.vcf>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 901 bytes
Desc: OpenPGP digital signature
URL: <http://mail.openjdk.java.net/pipermail/type-annotations-dev/attachments/20140318/13a50093/signature.asc>


More information about the type-annotations-dev mailing list