Repository navigation
How do i enable nullAnalysis? #522
Unanswered
alven-shin
asked this question in
Q&A
Replies: 2 comments 2 replies
|
Did you ever figure this out? I had a similar question at eclipse-jdtls/eclipse.jdt.ls#2952 but I could never understand how to apply the suggestion. |
2 replies
|
For anyone looking in the modern day. settings = {
java = {
compile = {
nullAnalysis = {
nonnull = {
"javax.annotation.Nonnull",
"org.eclipse.jdt.annotation.NonNull",
"org.springframework.lang.NonNull",
"org.jspecify.annotations.NonNull"
},
nullable = {
"javax.annotation.Nullable",
"org.eclipse.jdt.annotation.Nullable",
"org.springframework.lang.Nullable",
"org.jspecify.annotations.Nullable"
},
nonnullbydefault = {
"javax.annotation.ParametersAreNonnullByDefault",
"org.eclipse.jdt.annotation.NonNullByDefault",
"org.springframework.lang.NonNullApi",
"org.jspecify.annotations.NullMarked"
},
mode = "automatic",
}
}
}
}(likely to be the same issues initially encountered above, I'm not sure how different jdt.ls is from then to now, nor if there were any compounded issues) If any of them are not found, or if any of the lists are unset, the default eclipse annotations are used, and the null analysis is disabled.
sigh |
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
I would like to enable null analysis so I get warnings when I forget null checks on annotated variables. I tried the following config but it does not seem to work.
I am testing the feature with the following code, and in VS Code with the Java extension, a warning is produced for the missing null check.
All reactions