Annotations on generic constructors

Alex Buckley alex.buckley at oracle.com
Thu May 1 18:52:01 UTC 2014


See the thread "Queries about JDK-8035890" on type-annotations-dev: 
http://mail.openjdk.java.net/pipermail/type-annotations-dev/2014-March/thread.html. 
I wouldn't bet on javac allowing that @T for much longer. (I assumed 
Werner would file a spec bug, but that has not happened.)

Alex

On 5/1/2014 7:32 AM, John Spicer wrote:
> javac accepts this usage:
>
> import java.lang.annotation.ElementType;
> import java.lang.annotation.Target;
> @Target(ElementType.TYPE_USE)
> @interface T { }
> class X {
>    <P> @T X() { }
> }
>
> but that seems to be prohibited by the constructor declaration syntax,
> which only allows annotations before the TypeParameters.
>
> Should this case be rejected?
>
> John Spicer


More information about the compiler-dev mailing list