redhat-developer / redhat-developer/vscode-java

Null type safety not working with jakarta.validation.constraints.NotNull

Open
#3,501 8 comments 0 reactions 1 assignee View on GitHub

@snjeza is already working on this.

Since Feb 20, 2024.

upstream
Dominant language
TypeScript
Stars
2.3k
Forks
546
Avg merge
20h 1m
Merged PRs (30d)
11

Description

[provide a description of the issue]

Environment
  • Operating System: Linux Ubuntu 22.04
  • JDK version: 17.0.8 (Oracle GraalVM 17.0.8+9.1 build 17.0.8+9-LTS-jvmci-23.0-b14)
  • Visual Studio Code version: 1.86.2
  • Java extension version: v1.28.1
Steps To Reproduce
  1. Create a method with org.springframework.lang.NonNull annotation
  2. Calls that method with arguments annotated with jakarta.validation.constraints.NotNull
  3. A yellow line shows up on the method call highlighting: Null type safety: The expression of type 'String' needs unchecked conversion to conform to '@NonNull String'Java(16778128)

[Please attach a sample project reproducing the error]
Here:
warnings-bug.zip

Please attach logs
Here:
warning-logs.log

Current Result

VS Code says it could be null, it may have null value.

Expected Result

No warnings at all, since it was annotated with NotNull;

Additional Informations

None

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.