Huston, we have a problem !

Maurizio Cimadamore maurizio.cimadamore at
Wed Feb 16 03:11:40 PST 2011

On 16/02/11 10:04, Rémi Forax wrote:
> public class DiamondRaw {
>     public static void main(String[] args) {
>       String s = new String<>("foo");
>     }
> }
> Rémi
Ouch - good catch; JLS 4.5 requires that a compile-time error should be 
issued if the numbers of type-arguments of a parameterized type is 
different from the number of the type-parameters in the corresponding 
generic class declaration.
Now, with diamond this a bit of a gray area - i.e. can <> stand for a 
nilary type-argument list? If so, the above program should compile, 
otherwise it shouldn't. The compiler implements the former, but I agree 
with Remi that the latter should be preferred.


More information about the coin-dev mailing list