do not open captured wildcards on substitution; don't capture wildcards on getExtendsTypes for type parameters and their consequences

This commit is contained in:
Anna Kozlova
2015-12-02 10:17:29 +01:00
parent b9990696d3
commit 3a669178f5
27 changed files with 84 additions and 91 deletions
@@ -3,13 +3,13 @@ abstract class A<T> {
<K> void baz35(B<K, ? extends K> a) {}
abstract B<T,? super T> foo35();
void bar35(A<? super T> a){
baz35<error descr="'baz35(B<K,? extends K>)' in 'A' cannot be applied to '(B<capture<? super T>,capture<? super T>>)'">(a.foo35())</error>;
baz35<error descr="'baz35(B<K,? extends K>)' in 'A' cannot be applied to '(B<capture<? super T>,capture<? super capture<? super T>>>)'">(a.foo35())</error>;
}
<K> void baz44(B<K, ? extends K> a) {}
abstract B<? super T,? super T> foo44();
void bar44(A<? super T> a){
baz44<error descr="'baz44(B<K,? extends K>)' in 'A' cannot be applied to '(B<capture<? super T>,capture<? super T>>)'">(a.foo44())</error>;
baz44<error descr="'baz44(B<K,? extends K>)' in 'A' cannot be applied to '(B<capture<? super capture<? super T>>,capture<? super capture<? super T>>>)'">(a.foo44())</error>;
}
}
@@ -10,7 +10,7 @@ abstract class A<T> {
<K> void baz39(B<K, ? extends K> a) {}
abstract B<T,? extends T> foo39();
void bar39(A<? extends T> a){
baz39<error descr="'baz39(B<K,? extends K>)' in 'A' cannot be applied to '(B<capture<? extends T>,capture<? extends T>>)'">(a.foo39())</error>;
baz39(a.foo39());
}
<K> void baz52(B<K, ? extends K> a) {}
@@ -22,7 +22,7 @@ abstract class A<T> {
<K> void baz54(B<K, ? extends K> a) {}
abstract B<? extends T,? extends T> foo54();
void bar54(A<? extends T> a){
baz54<error descr="'baz54(B<K,? extends K>)' in 'A' cannot be applied to '(B<capture<? extends T>,capture<? extends T>>)'">(a.foo54())</error>;
baz54<error descr="'baz54(B<K,? extends K>)' in 'A' cannot be applied to '(B<capture<? extends capture<? extends T>>,capture<? extends capture<? extends T>>>)'">(a.foo54())</error>;
}
@@ -39,7 +39,7 @@ class VarianceTesting {
k[0] = new VarianceTesting();
x.method()[0] = new VarianceTesting();
<error descr="Incompatible types. Found: 'VarianceTesting[]', required: 'capture<? extends VarianceTesting>[]'">x.arrayField = new VarianceTesting[10]</error>;
l1.addAll<error descr="'addAll(java.util.Collection<capture<? extends VarianceTesting>>)' in 'java.util.List' cannot be applied to '(java.util.ArrayList<VarianceTesting>)'">(new ArrayList<VarianceTesting>())</error>;
l1.addAll<error descr="'addAll(java.util.Collection<? extends capture<? extends VarianceTesting>>)' in 'java.util.List' cannot be applied to '(java.util.ArrayList<VarianceTesting>)'">(new ArrayList<VarianceTesting>())</error>;
<error descr="Incompatible types. Found: 'java.util.ArrayList<java.lang.String>', required: 'java.util.List<? extends VarianceTesting>'">List<? extends VarianceTesting> l2 = new ArrayList<String>();</error>
List<? extends VarianceTesting> l3 = l2;
VarianceTesting t = l1.get(0);
@@ -10,7 +10,7 @@ class NachCollections<K,V> {
Collection<? super Map.Entry<K,V>> c2,
Consumer<Map.Entry<K, V>> a) {
c1.forEach(consumer(a));
c2.forEach<error descr="'forEach(java.util.function.Consumer<capture<? super java.util.Map.Entry<K,V>>>)' in 'java.lang.Iterable' cannot be applied to '(java.util.function.Consumer<java.util.Map.Entry<K,V>>)'">(consumer(a))</error>;
c2.forEach<error descr="'forEach(java.util.function.Consumer<? super capture<? super java.util.Map.Entry<K,V>>>)' in 'java.lang.Iterable' cannot be applied to '(java.util.function.Consumer<java.util.Map.Entry<K,V>>)'">(consumer(a))</error>;
}
}