capture conversion: collect all type parameter's bounds during capture conversion; make sure collected upper bound is used after capture type is normalized

This commit is contained in:
Anna Kozlova
2015-04-20 10:19:20 +02:00
parent 8a72738f5a
commit 2318a3a58c
6 changed files with 52 additions and 10 deletions
@@ -0,0 +1,16 @@
import java.util.List;
class G<T extends List<String> & Runnable> {
T get() {return null;}
}
interface I extends List<String>, Runnable {}
abstract class Test {
abstract G<? super I> m();
{
m().get().run();
String s = m().get().get(0);
}
}
@@ -311,7 +311,7 @@ class WithingBounds {
A<A<<error descr="Type parameter 'A' is not within its bound; should extend 'A<A>'">A</error>>> a3;
A<? extends A> a4;
A<<error descr="Type parameter '? super A' is not within its bound; should extend 'A<A<? super A>>'">? super A</error>> a5;
A<<error descr="Type parameter '? super A' is not within its bound; should extend 'A<? super A>'">? super A</error>> a5;
A<<error descr="Type parameter 'A[]' is not within its bound; should extend 'A<A[]>'">A[]</error>> a7;
}
}
@@ -311,7 +311,7 @@ class WithingBounds {
A<A<<error descr="Type parameter 'A' is not within its bound; should extend 'A<A>'">A</error>>> a3;
A<? extends A> a4;
A<<error descr="Type parameter '? super A' is not within its bound; should extend 'A<A<? super A>>'">? super A</error>> a5;
A<<error descr="Type parameter '? super A' is not within its bound; should extend 'A<? super A>'">? super A</error>> a5;
A<<error descr="Type parameter 'A[]' is not within its bound; should extend 'A<A[]>'">A[]</error>> a7;
}
}