checker-framework
checker-framework copied to clipboard
Incorrect enclosing types
The following code should issue an error, but doesn't.
import org.checkerframework.checker.nullness.qual.Nullable;
public class Issue4853B {
interface Interface<Q> {}
static class MyClass<T> {
class InnerMyClass implements Interface<T> {}
}
abstract static class SubMyClass extends MyClass<@Nullable String> {
protected void f() {
// :: error: (assignment)
Interface<@Nullable String> callback = method(); // missing error here.
}
abstract InnerMyClass method();
}
}
The problem is the return type of method is MyClass<@NonNull String>.InnerMyClass where @NonNull is defaulted. Instead of defaulting, the enclosing type of InnerMyClass should be computed from the enclosing type of this. I would guess there are other place where the Checker Framework isn't computing the correct enclosing type.