report when notnull type is instantiated with unknown nullity (IDEA-CR-21203)

This commit is contained in:
peter
2017-06-06 17:41:59 +02:00
parent 10c38d0c49
commit e5b892bd23
4 changed files with 31 additions and 12 deletions
@@ -3,13 +3,9 @@ import java.util.*;
class MyList<T extends @NotNull Number> extends ArrayList<T> {}
class SubList extends MyList<<warning descr="Nullable type argument where non-null one is expected">@Nullable Integer</warning>> {
MyList<<warning descr="Nullable type argument where non-null one is expected">@Nullable Integer</warning>> myList;
class SubList extends MyList<<warning descr="Non-null type argument is expected">@Nullable Integer</warning>> {
MyList<<warning descr="Non-null type argument is expected">@Nullable Integer</warning>> myList;
}
class MyNonNullGenericClass<T extends @NotNull Object> {
public static void test() {
MyNonNullGenericClass<<warning descr="Nullable type argument where non-null one is expected">@Nullable String</warning>> foo = new MyNonNullGenericClass<>();
}
}
@@ -0,0 +1,18 @@
import typeUse.*;
import java.util.*;
class MyNonNullGenericClass<T extends @NotNull Object> {
public static void test() {
MyNonNullGenericClass<<warning descr="Non-null type argument is expected">@Nullable String</warning>> foo = new MyNonNullGenericClass<>();
}
}
class Parent<A extends @Nullable Object, B extends @NotNull Object> { }
class Child<A, B> extends Parent<B, <warning descr="Non-null type argument is expected">A</warning>> {
void test2() {
Parent<@Nullable String, <warning descr="Non-null type argument is expected">@Nullable String</warning>> p = new Parent<>();
Child<@Nullable String, @Nullable String> c = new Child<>();
}
}