Java 8 language spec flaw/bug

Maurizio Cimadamore maurizio.cimadamore at
Fri Aug 22 16:56:57 UTC 2014

On 22/08/14 17:45, Davin McCall wrote:
> 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. 
Well, if you look at Dan's eval of 8044053, he explains that the 
conditional is missing the same subtle check that has been applied for 
nested method calls - i.e. a reference conditional is always a poly 
conditional - it's never type-checked bottom up; on the other hand, for 
nested method calls there is some extra analysis to prevent constraint 
propagation and to allow for more compatibility. I think that, in the 
case of conditionals, there's a design tension between being able to 
define a granular enough classification (poly vs. standalone) that will 
allow 'reasonable' code to compile vs. defining a classification 
analysis that's easy to spot when you read the code.


More information about the lambda-dev mailing list