redhat-developer / redhat-developer/vscode-java
Recognize contractual non-nullness of standard library functions
Nobody has claimed this yet.
- Dominant language
- TypeScript
- Stars
- 2.3k
- Forks
- 546
- Avg merge
- 20h 1m
- Merged PRs (30d)
- 11
Description
The nullness analyzer does not recognize that certain standard library functions will, contractually, never return null. A common example would be Integer::toString.
These methods will generate unchecked cast warnings if assigned to a @Nonnull field.
As I understand, the plugin relies on Eclipse JDT for nullness analysis. I have come across LastNPE, which publishes JDT-compatible external null annotation files for many common libraries.
Would it be possible to include these annotations by default? Alternatively, if this is not desirable, could EAA files be supported by the plugin?
Environment
- Operating System: Windows 10 Enterprise
- JDK version: openjdk 11.0.12 2021-07-20
- Visual Studio Code version: 1.71.2
- Java extension version: v1.11.0
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
No source file or test is named in the issue. Start by examining how the extension delegates nullness analysis to Eclipse JDT and compare LastNPE's JDT-compatible annotations with the requested EAA support; done means standard-library methods such as Integer::toString no longer produce unchecked-cast warnings when assigned to @Nonnull fields.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- java, typescript, vscode
- Domain
- tooling
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 42/100