new inference: check equals/upper/low bounds consistency

This commit is contained in:
Anna Kozlova
2015-05-29 14:48:27 +02:00
parent 8164a3e4b7
commit 7b0c5b6d05
10 changed files with 44 additions and 49 deletions
@@ -7,6 +7,6 @@ abstract class B {
}
void foo(Class<?> aClass) {
A a = <error descr="Inferred type 'capture<?>' for type parameter 'T' is not within its bound; should extend 'A'">getA(aClass)</error>;
A a = getA<error descr="'getA(java.lang.Class<T>)' in 'B' cannot be applied to '(java.lang.Class<capture<?>>)'">(aClass)</error>;
}
}
@@ -7,9 +7,9 @@ class B<T> extends A<A<T>> {
foo(sb);
foo(s);
<error descr="Inferred type 'capture<?>' for type parameter 'T' is not within its bound; should extend 'java.lang.String'">foo1(b)</error>;
foo1<error descr="'foo1(A<A<T>>)' in 'B' cannot be applied to '(B<capture<?>>)'">(b)</error>;
foo1(eb);
<error descr="Inferred type 'capture<? super java.lang.String>' for type parameter 'T' is not within its bound; should extend 'java.lang.String'">foo1(sb)</error>;
foo1<error descr="'foo1(A<A<T>>)' in 'B' cannot be applied to '(B<capture<? super java.lang.String>>)'">(sb)</error>;
foo1(s);
foo2(b);
@@ -35,7 +35,7 @@ class Test {
}
void bug1(Parametrized<? super T> param) {
<error descr="Inferred type 'capture<? super T>' for type parameter 'I' is not within its bound; should extend 'java.lang.Number'">foo(param)</error>;
foo<error descr="'foo(Test.Parametrized<I>)' in 'Test.Bug1' cannot be applied to '(Test.Parametrized<capture<? super T>>)'">(param)</error>;
}
@@ -214,7 +214,7 @@ public static void foo(List<? extends Foo> foos) {
class OtherBug1 {
public static void foo(List<? super Foo> foos) {
final Comparator<Foo> comparator = createComparator();
Collections.sort<error descr="'sort(java.util.List<capture<? super OtherBug1.Foo>>, java.util.Comparator<capture<? super OtherBug1.Foo>>)' in 'java.util.Collections' cannot be applied to '(java.util.List<capture<? super OtherBug1.Foo>>, java.util.Comparator<OtherBug1.Foo>)'">(foos, comparator)</error>;
Collections.sort<error descr="'sort(java.util.List<T>, java.util.Comparator<? super T>)' in 'java.util.Collections' cannot be applied to '(java.util.List<capture<? super OtherBug1.Foo>>, java.util.Comparator<OtherBug1.Foo>)'">(foos, comparator)</error>;
}
private static Comparator<Foo> createComparator() {
@@ -28,7 +28,7 @@ class Test {
public static void main(String[] args) {
IConverter<String> converter = getConverter(String.class);
IConverter<String> converter1 = getConverter1(String.class);
IConverter<String> converter2 = <error descr="Inferred type 'java.lang.String' for type parameter 'C' is not within its bound; should extend 'java.lang.Double'">getConverter2(String.class)</error>;
IConverter<String> converter2 = getConverter2<error descr="'getConverter2(java.lang.Class<C>)' in 'Test' cannot be applied to '(java.lang.Class<java.lang.String>)'">(String.class)</error>;
}
}