Question about error message for primitive type arguments[Re: The compiler rejects <void>this/super().]
bitter_fox
bitterfoxc at gmail.com
Thu Mar 8 10:52:32 PST 2012
Thank you for the fix.
I have a question about the error message for primitive type arguments.
Old javac says "unexpected type" for this.<int>m(), <int>this/super() and
Clazz<int>.
However, today's implementation says it only for Clazz<int>.
It says another massage for this.<int>m() and <int>this/super():
Main.java:9: error: no suitable constructor found for Main(<null>)
<int>this(null);
^
constructor Main.Main() is not applicable
(actual and formal argument lists differ in length)
constructor Main.<T>Main(Object) is not applicable
(explicit type argument int does not conform to declared bound(s)
Object)
where T is a type-variable:
T extends Object declared in constructor <T>Main(Object)
Main.java:10: error: method m in class Main<T> cannot be applied to given
types;
this.<int>m();
^
required: no arguments
found: no arguments
reason: explicit type argument int does not conform to declared bound(s)
Objec
t
where T is a type-variable:
T extends Object declared in class Main
Was this change intended?
Regards,
bitter_fox
2012/3/8 Maurizio Cimadamore <maurizio.cimadamore at oracle.com>
> On 08/03/12 09:46, bitter_fox wrote:
>
>> class Main
>> {
>> public<throws E> Main(Object o) {}
>>
>> public Main()
>> {
>> <void>this(null); // Illegal
>> }
>> }
>>
>> Nicely spotted - thanks!
>
> Maurizio
>
More information about the lambda-dev
mailing list