You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
For example, we have the following test case that throws an NPE:
public class ReceiverTypeArgs {
static class Box<T> {
T item;
public Box(T item) {
this.item = item;
}
void test(Box<@NonNull T> this) {
System.out.println(this.item.toString());
}
}
private static void foo(Box<@Nullable String> box) {
// expected: invalid method receiver
box.test();
}
public static void main(String[] args) {
foo(new Box<>(null));
}
}
Note that the method receiver parameter Box<@NonNull T> this should not accept the argument Box<@Nullable String> box since generics are invariant. However, the Checker Framework doesn't have any warnings for this test case.
The text was updated successfully, but these errors were encountered:
For example, we have the following test case that throws an NPE:
Note that the method receiver parameter
Box<@NonNull T> this
should not accept the argumentBox<@Nullable String> box
since generics are invariant. However, the Checker Framework doesn't have any warnings for this test case.The text was updated successfully, but these errors were encountered: