typetools / typetools/checker-framework
Nullness Checker unsoundness with inner classes
Open
Nobody has claimed this yet.
False Negative (missing warning or unsoundness)
- Dominant language
- Java
- Stars
- 1.1k
- Forks
- 440
- Avg merge
- 1d 12h
- Merged PRs (30d)
- 134
Description
import org.checkerframework.checker.nullness.qual.Nullable;
public class Test {
class A<X> {
X field;
A(X val) {this.field = val;}
class B<Y> {
X get() { return A.this.field; }
}
}
void test(A<@Nullable String>.B<@Nullable String> b) {
b.get().hashCode();
}
public static void main(String[] args) {
Test t = new Test();
t.test(t.new A<@Nullable String>(null).new B<@Nullable String>());
}
}
This passes the Nullness Checker but throws an NPE at runtime. I think there should be an error reported inside test() at the de-reference of b.get().
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by running the supplied Java reproducer with the Nullness Checker and confirm that the dereference of b.get() is accepted before the runtime NPE. Trace the Nullness Checker handling of generic inner classes and qualified outer-instance fields; done means the checker reports an error at that dereference and the regression is covered by a test.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- java
- Domain
- compilers
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100