Skip to content

Recognize contractual non-nullness of standard library functions #2731

Open
@Treeston

Description

@Treeston

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

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions