You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Null type safety not working with jakarta.validation.constraints.NotNull #3501
Create a method with org.springframework.lang.NonNull annotation
Calls that method with arguments annotated with jakarta.validation.constraints.NotNull
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
changed the title [-]Null type safety not working with jakarta.vaidation.notNull[/-][+]Null type safety not working with jakarta.validation.constraints.NotNull[/+]on Feb 16, 2024
Hi @snjeza, I'm wondering if you could elaborate on the following statement:
@fbricon@rgrunber We could set this property per default when null analysis is enabled.
Why would jdtls set that property when null analysis is enabled? Does nullUncheckedConversion no longer apply in that case?
Context: I'm using jdtls in a project with existing Eclipse settings, and trying to reconcile the changes that jdtls is making to those settings. See eclipse-jdtls/eclipse.jdt.ls#2655 (comment)
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)
@snjeza Thanks, I understand. The part that isn't clear is whether there is a downside to nullUncheckedConversion=ignore, or if it is completely obviated by null analysis.
Or another way to ask: Does the jdtls know that org.springframework.lang.NonNull and jakarta.validation.constraints.NotNull are both non-null annotations? Only the former appears in the jdtls sources. It seems that the latter is simply not recognized as a non-null annotation, and the provided zip-file doesn't contain any configuration to change this.
In that case, disabling nullUncheckedConversion might not be the right answer.
Activity
[-]Null type safety not working with jakarta.vaidation.notNull[/-][+]Null type safety not working with jakarta.validation.constraints.NotNull[/+]snjeza commentedon Feb 19, 2024
@RMCampos you can try to add
to <your_project>/.settings/org.eclipse.jdt.core.prefs
@fbricon @rgrunber We could set this property per default when null analysis is enabled.
thermcampos commentedon Feb 19, 2024
@snjeza I have to projects inside the same root directory. Shall I put this on the root directory, or inside each project?
snjeza commentedon Feb 19, 2024
@RMCampos You may want to take a look at Settings Global Preferences
thermcampos commentedon Feb 19, 2024
@snjeza that worked! Thank you!
agriffis commentedon Jul 16, 2024
Hi @snjeza, I'm wondering if you could elaborate on the following statement:
Why would jdtls set that property when null analysis is enabled? Does
nullUncheckedConversionno longer apply in that case?Context: I'm using jdtls in a project with existing Eclipse settings, and trying to reconcile the changes that jdtls is making to those settings. See eclipse-jdtls/eclipse.jdt.ls#2655 (comment)
snjeza commentedon Jul 16, 2024
@agriffis We want to avoid
See Steps To Reproduce
agriffis commentedon Jul 16, 2024
@snjeza Thanks, I understand. The part that isn't clear is whether there is a downside to
nullUncheckedConversion=ignore, or if it is completely obviated by null analysis.Or another way to ask: Does the jdtls know that
org.springframework.lang.NonNullandjakarta.validation.constraints.NotNullare both non-null annotations? Only the former appears in the jdtls sources. It seems that the latter is simply not recognized as a non-null annotation, and the provided zip-file doesn't contain any configuration to change this.In that case, disabling
nullUncheckedConversionmight not be the right answer.fbricon commentedon Oct 17, 2025
Reopening as automatically disabling nullUncheckedConversion is not a universal solution