unchecked warning: mark as unchecked if passed to strict subtyping (IDEA-151302)

This commit is contained in:
Anna Kozlova
2016-02-17 14:44:12 +01:00
parent 569a7ca9f4
commit 17743c0a87
5 changed files with 32 additions and 3 deletions
@@ -1,5 +1,5 @@
class Foo<T extends Enum> {
public T bar(Class<? extends T> type, String str) {
return Enum.valueOf<error descr="'valueOf(java.lang.Class<T>, java.lang.String)' in 'java.lang.Enum' cannot be applied to '(java.lang.Class<capture<? extends T>>, java.lang.String)'">(type, str)</error>;
<error descr="Incompatible types. Found: 'java.lang.Enum', required: 'T'">return Enum.valueOf(type, str);</error>
}
}
@@ -0,0 +1,21 @@
import java.util.List;
interface FacetId<T extends List> {}
abstract class One {
public abstract <F extends List<C>, C extends One> void findFacetType(FacetId<F> typeId);
private void addSubFacet(FacetId<?> underlyingType) {
findFacetType(underlyingType);
}
}
class Bar<X extends Foo> {}
class Foo<C> {}
class Main {
void foo(Bar<?> a) {
m(a);
}
<X extends Foo<C>, C> void m(Bar<X> a) {
}
}
@@ -12,7 +12,10 @@ class Test {
SuperFoo<String> ls = foo(<error descr="no instance(s) of type variable(s) exist so that String conforms to Number
inference variable R has incompatible bounds:
equality constraints: String
upper bounds: Object, Number">() -> new Foo<>()</error>);
upper bounds: Object, Number
inference variable X has incompatible bounds:
equality constraints: R
upper bounds: Number">() -> new Foo<>()</error>);
SuperFoo<Integer> li = foo(() -> new Foo<>());
SuperFoo<?> lw = foo(() -> new Foo<>());
}