Queries about JDK-8035890

Werner Dietl wdietl at gmail.com
Fri Mar 28 14:47:30 UTC 2014

Alex, Jan,

>> These are supposed to be invalid:
>> public class Foo {
>>      <T> @DA Foo() { }
>>      <T> @TA Foo(int i) { }
>> }
> Ah, constructor declarations. The EG never discussed allowing
> annotations after the type parameter section there. I guess that was an
> oversight, but as things stand your two ctors are invalid.

For consistency, shouldn't the last line be allowed?

@TA Foo(int i) { }

is legal, as is

@TA Object bar(int i) { ... }

Adding type parameters to the method doesn't change it's legality and

<T> @TA Object bar(int i) { ... }

is still legal.
So why should doing the same with a ctor be illegal?

<T> @TA Foo(int i) { }

would seem consistent to me.

I agree with all other comments made in the message.

cu, WMD.

More information about the type-annotations-dev mailing list