Java 8 language spec flaw/bug
davmac at bluej.org
Fri Aug 22 16:45:49 UTC 2014
> I'm reading through the spec again now to try and see where it's going
Urgh. The spec is not going wrong at all (at least not for the case of
I followed the spec closely and discovered that it does in fact appear
to do the right thing - it resolves the return type of the inner method
first, and doesn't apply equality constraints to the T parameter of the
"foo" method. It appears I was seeing a compiler bug which has since
been fixed, because in Jdk 8u20 the problem no longer manifests.
Apologies if I've wasted anyone's time.
Using the ternary operator, however, still fails. I don't see why it
shouldn't behave in exactly the same way as the "ternary" method I
defined in my example, however. I am somewhat suspicious that perhaps
the compiler, and not the spec, is again to blame.
More information about the lambda-dev