-
Notifications
You must be signed in to change notification settings - Fork 724
JAVASE-241 Treat Bean Validation @NotNull as WEAK_NULLABLE to fix FPs (JAVASE-241) #5991
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -91,6 +91,11 @@ private JSymbolMetadataNullabilityHelper() { | |
| "io.reactivex.rxjava3.annotations.Nullable", | ||
| "javax.annotation.Nullable", | ||
| "jakarta.annotation.Nullable", | ||
| // Bean Validation @NotNull is a runtime constraint, not a static nullability guarantee. | ||
| // It is placed here rather than NONNULL_ANNOTATIONS because it cannot serve as a reliable | ||
| // static analysis signal (especially when groups= is used), so it is treated conservatively. | ||
| "javax.validation.constraints.NotNull", | ||
| "jakarta.validation.constraints.NotNull", | ||
|
Comment on lines
+97
to
+98
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 💡 Bug: Reclassifying @NotNull may silently change untested SE rulesMoving Was this helpful? React with 👍 / 👎 |
||
| "org.checkerframework.checker.nullness.compatqual.NullableDecl", | ||
| "org.checkerframework.checker.nullness.compatqual.NullableType", | ||
| "org.checkerframework.checker.nullness.qual.Nullable", | ||
|
|
@@ -119,8 +124,6 @@ private JSymbolMetadataNullabilityHelper() { | |
| "edu.umd.cs.findbugs.annotations.NonNull", | ||
| "io.reactivex.annotations.NonNull", | ||
| "io.reactivex.rxjava3.annotations.NonNull", | ||
| "javax.validation.constraints.NotNull", | ||
| "jakarta.validation.constraints.NotNull", | ||
| "lombok.NonNull", | ||
| "org.checkerframework.checker.nullness.compatqual.NonNullDecl", | ||
| "org.checkerframework.checker.nullness.compatqual.NonNullType", | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
💡 Quality: Bean Validation @NotNull FQN set duplicated across 3 files
The two FQNs
javax.validation.constraints.NotNullandjakarta.validation.constraints.NotNullare now hard-coded in three independent places:WEAK_NULLABLE_ANNOTATIONSin JSymbolMetadataNullabilityHelper,BEAN_VALIDATION_ANNOTATIONSin ChangeMethodContractCheck, andCONSTRAINT_ANNOTATIONS_NOT_FLAGGEDin PrimitivesMarkedNullableCheck. A future change (e.g. adding another BV constraint or a new package) risks being applied inconsistently. Consider exposing a single shared constant/helper (e.g. anisBeanValidationNotNull(String fqn)in a shared helper) and referencing it from all three sites.Was this helpful? React with 👍 / 👎