More on patterns, generics, null and primitives

Brian Goetz brian.goetz at oracle.com
Sat Dec 9 14:10:08 UTC 2017


Well, there is no current “spec”... But in any case the implementation is lagging the design (is might be expected).  

Sent from my iPad

> On Dec 8, 2017, at 11:58 PM, Ali Ebrahimi <ali.ebrahimi1781 at gmail.com> wrote:
> 
> Hi,
> 
>> we would infer the type of y from the static type of X, and would most likely use the same inference algorithm as we do for locals.  Since inference would say "you can't infer the null type", we wouldn't get farther.
> So with current spec 'null matches var x' would not compile or results in false? But the last I tried current prototype accept this code.
> If we accept this code then we have the following problem:
> 
> if( null matches var x || true){
> 
> .....
>      what is type x here?
> }
> 
> 
>> If the user said 
>> 
>>     (null instanceof Object x)
> There is typo here  (null instanceof Object)? no binding variable here? 
> 
>> it would be a different story, since there's no inference to do.  But null instanceof anything already has a defined answer -- no.  
> 
> -- 
> 
> Best Regards,
> Ali Ebrahimi


More information about the amber-spec-observers mailing list