typetools / typetools/checker-framework
Annonymous class in field initializer needs to treat surrounding class as under initialization
Open
@wmdietl is already working on this.
Since Sep 7, 2016.
bug
Dataflow
False Negative (missing warning or unsoundness)
- Dominant language
- Java
- Stars
- 1.1k
- Forks
- 440
- Avg merge
- 1d 12h
- Merged PRs (30d)
- 134
Description
No error about clear NPE when calling function in annonymous class from constructor.
Discovered while discussing #903. Tested with v2.1.1.
class Foo {
private final Object mBar;
private final Runnable mRunnable =
new Runnable() {
@Override
public void run() {
// No problem, even though it NPEs.
mBar.toString();
}
};
public Foo() {
mRunnable.run();
mBar = "";
}
public static void main(String[] args) {
new Foo();
}
}
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.
Assessment
This issue has not been assessed yet.