Re: 18.2.3 fails to properly reduce ⟨null <: α⟩
Rafkind, Jon
jon.rafkind at hp.com
Wed Jan 29 11:07:11 PST 2014
On 01/24/2014 04:40 PM, Stephan Herrmann wrote:
> Srikanth brought up a test case[1] that seems to reveal a bug in 18.2.3.
>
> Indirectly the example shows that inference can produce a solution
> that instantiates a type variable to the null type.
> Since it occurred in a varargs context we are trying to generate
>
> new null[]
>
> The problem seems to be in the order of rules in 18.2.3.
> The constraint ⟨null <: α⟩ reduces to the bound null <: α
> where it actually should reduce to true, right?
>
> best,
> Stephan
>
>
>
> [1] https://bugs.eclipse.org/bugs/show_bug.cgi?id=426534
>
I just discovered this issue and concur with the fix. Here is another
simple test case
public class Null{
public <K> void foo(K k){
}
public void test(){
foo(null);
}
}
18.2.3 is also the only place in the spec that mentions null so I am
wondering if the check for T being null should be moved ahead as well so
that you don't end up with 'a <: null', not that I have ever seen that
occur in practice.
More information about the lambda-spec-observers
mailing list