typetools / typetools/checker-framework
Interaction between NotOnlyInitialized and UnderInitialization
Nobody has claimed this yet.
- Dominant language
- Java
- Stars
- 1.1k
- Forks
- 440
- Avg merge
- 1d 12h
- Merged PRs (30d)
- 134
Description
There appears to be an odd interaction between NotOnlyInitialized and UnderInitialization.
Reading https://checkerframework.org/manual/#fig-initialization-hierarchy and the sections after it, I understand that an object is considered UnderInitialization for itself when all of the non-null fields have been assigned.
I have a class that has a NotOnlyInitialized field and a NonNull field. Once both fields are initialized I call a private method on the class. At this point I expect the state of this to be UnderInitialization(current class), however it's UnderInitialization(parent class).
Steps to reproduce:
- git clone https://github.com/jpschewe/checker-bugs.git
- cd checker-bugs
- git checkout notonlyinitialized-underinitialization
- ./gradlew clean; ./gradlew classes
Resulting error
/home/jpschewe/projects/checker-bugs/src/main/java/net/mtu/eggplant/checker/issue4613/SchedulerUI.java:25: error: [method.invocation] call to createMenubar() not allowed on the given receiver.
createMenubar();
^
found : @UnderInitialization(javax.swing.JFrame.class) @NonNull SchedulerUI
required: @UnderInitialization(net.mtu.eggplant.checker.issue4613.SchedulerUI.class) @NonNull SchedulerUI
1 error
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
Clone jpschewe/checker-bugs, check out notonlyinitialized-underinitialization, and run ./gradlew clean; ./gradlew classes to reproduce the error. Start with src/main/java/net/mtu/eggplant/checker/issue4613/SchedulerUI.java and the Checker Framework initialization hierarchy documentation; done means the reported method.invocation error is resolved while the example still builds.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- java
- Domain
- devtools
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100