Java 8 language spec flaw/bug

Maurizio Cimadamore maurizio.cimadamore at oracle.com
Fri Aug 22 16:42:55 UTC 2014


On 22/08/14 16:28, Davin McCall wrote:
> static <T>  T foo(Class<T>  clazz)
>        static  <U>  U ternary(boolean  cond,  U a,  U b)
>        foo(ternary(true, String.class, StringBuilder.class));
This _does_ compile (at least it does in 9) and it is a very different 
example from the one quoted in the bug you mentioned [1], which has 
Class<U> as formals, not just bare U as here.

[1] - https://bugs.openjdk.java.net/browse/JDK-8044053


More information about the lambda-dev mailing list