Fwd: Huston, we have a problem !
"Zdeněk Troníček"
tronicek at fit.cvut.cz
Wed Feb 16 12:01:14 PST 2011
Isn't <> rather "do the type inference from the type on the left side of
assignment"? Then
HashMap p = new HashMap<>();
is wrong because the type of the variable on the left side is not
parameterized.
And if you proposed to treat raw types as generic with no type parameter,
you would have allowed the following syntax:
String<> p;
Z.
--
Zdenek Tronicek
FIT CTU in Prague
Ben Evans napsal(a):
> Try again, actually replying to list this time.
>
> Sent from my iPhone
>
> Begin forwarded message:
>
>> From: Ben Evans <benjamin.john.evans at gmail.com>
>> Date: 16 February 2011 17:05:12 GMT
>> To: Joshua Bloch <jjb at google.com>
>> Subject: Re: Huston, we have a problem !
>>
>
>> OK, at the risk of looking stupid - why?
>>
>> I read <> as a "do some type inference about the generics" - if it's not
>> a generic type, then I could see it resolving to nothing at all.
>>
>> In a related example, what about the case of a raw type on the LHS?
>>
>> HashMap hm = new HashMap<>();
>>
>> If the non-generic example is deemed to be a syntax error, what about
>> this case?
>>
>> Thanks,
>>
>> Ben
>>
>> On 16 Feb 2011, at 16:26, Joshua Bloch <jjb at google.com> wrote:
>>
>>> I agree that it should be illegal.
>>>
>>> Josh
>>>
>
>
More information about the coin-dev
mailing list