| Other |
|---|
| tbd_majorResolved |
|
Duplicate :
|
|
|
Relates :
|
|
|
Relates :
|
|
|
Relates :
|
This should compile, does not:
interface I<X> {}
<T> T make(I<T> ts) { return null; }
<E extends CharSequence> E take(I<? extends E> arg) { return null; }
void test(I<I<? extends String>> arg) {
take(make(arg)).intern();
}
Inference succeeds, with E=CharSequence. The call to 'intern' then fails. Expected: infer E=String.
Walking through expected inference behavior:
Applicability inference for 'make':
I<I<? extends String>> --> I<t>
{ t = I<? extends String> }
Applicability inference for 'take':
make(arg) --> I<? extends e>
t --> I<? extends e>
{ t = I<? extends String>, t <: I<? extends e>, e <: CharSequence }
Incorporation:
I<? extends String> <: I<? extends e>
{ t = I<? extends String>, t <: I<? extends e>, String <: e, e <: CharSequence }
Resolution:
e = String, t = I<? extends String>
|