Open wmdietlGC opened 7 years ago
Run the Nullness Checker on:
import org.checkerframework.checker.nullness.qual.Nullable; interface I<T> { void foo(T p); } class Foo { void foo(I<@Nullable Object> p) {} void bar() { foo(new I<Object>() { public void foo(Object p) {} }); } }
You will get:
Bug.java:10: error: [argument.type.incompatible] incompatible types in argument. foo(new I<Object>() { ^ found : Foo.@Initialized @NonNull <anonymous Foo$1> required: @Initialized @NonNull I<@Initialized @Nullable Object> 1 error
The <anonymous Foo$1> is making it hard to see that the type argument mismatches.
<anonymous Foo$1>
If you change the example to have a Java type mismatch, e.g. to:
void foo(I<String> p) {} void bar() { foo(new I<Object>() {
you get:
Bug.java:10: error: incompatible types: <anonymous I<Object>> cannot be converted to I<String>
That is, instead of Foo$1 you see the more useful I<Object>.
Foo$1
I<Object>
We should do the same thing for the Checker Framework.
Maybe fix together with #890
Run the Nullness Checker on:
You will get:
The
<anonymous Foo$1>
is making it hard to see that the type argument mismatches.If you change the example to have a Java type mismatch, e.g. to:
you get:
That is, instead of
Foo$1
you see the more usefulI<Object>
.We should do the same thing for the Checker Framework.