typetools / typetools/checker-framework
Array element type should not be inferred as @Poly*
Nobody has claimed this yet.
- Dominant language
- Java
- Stars
- 1.1k
- Forks
- 440
- Avg merge
- 1d 12h
- Merged PRs (30d)
- 134
Description
Consider the code in file checker-framework/checker/tests/nullness/Issue653.java.
An expression
new String[] {myNonNullString}
is inferred to be of type
@PolyNull String []
when used in a context where that type is expected.
The expression should be inferred to be of type
@NonNull String []
instead.
More generally, @PolyNull should not be considered a type itself -- it's really a type variable.
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 with checker-framework/checker/tests/nullness/Issue653.java and inspect how the array initializer is inferred when it contains myNonNullString. Trace the handling of @PolyNull as a type variable in the relevant type-inference code. Done means the expression is inferred as @NonNull String[] rather than @PolyNull String[] in this context, with the regression covered by the issue test.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- java
- Domain
- compilers, devtools
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Clearly specified
- Newbie friendliness
- 45/100