change in inference of unchecked calls after JDK-8147493
Maurizio Cimadamore
maurizio.cimadamore at oracle.com
Tue Jan 26 10:18:42 UTC 2016
I will look into this. Thanks.
Maurizio
On 26/01/16 04:03, Liam Miller-Cushon wrote:
> The fix for JDK-8147493 (regression when type-checking unchecked
> method calls) prevents the following code from compiling. It is
> accepted by 8, and earlier versions of 9-dev. The return type of
> w(...) is now being inferred as S<Q<Object>>. Shouldn't the unchecked
> call cause return types to be erased?
>
> abstract class Test {
>
> interface R<E> {}
> interface Q<T> {}
> interface T { <E> Q<E> n(R<E> r); }
> abstract <T> T isA(Class<T> t);
> abstract <T> S<T> w(T t);
> interface S<T> { S<T> t(T value); }
>
> void f(T t, Q<String> q) {
> w(t.n(isA(R.class))).t(q);
> }
> }
>
>
> error: incompatible types: Q<String> cannot be converted to Q<Object>
> w(t.n(isA(R.class))).t(q);
> ^
>
> Thanks,
> Liam
More information about the compiler-dev
mailing list