JAVASE-241 Remove Bean Validation @NotNull annotaions from nullability configuration to fix FPs - #5991
Conversation
GabrielFleischer
left a comment
There was a problem hiding this comment.
I am definitely open to discussion, but I feel in the end, the annotations are used to express something tangent to the nullability of the target and we should not try to extract information from it.
I feel like we should simply remove ignore them completely and treat annotated targets as UNKNOWN.
It will remove the need for the changes in the two rules while fixing the problems raised in the ticket.
What do you think ?
After discussion we decided to remove support for jakarta / javax NonNull annotations. |
…VASE-241) javax.validation.constraints.NotNull and jakarta.validation.constraints.NotNull are runtime constraints with no static nullability semantics. Removing them from all annotation lists (previously NON_NULL, then WEAK_NULLABLE) lets them resolve to UNKNOWN, which is the correct treatment: the engine makes no nullability assumptions and no rules fire based on them. Rules naturally unaffected as a consequence: - S4454: @NotNull on equals() param resolves to UNKNOWN, not isNonNull() → no FP - S6539: @NotNull inside @NullMarked resolves to UNKNOWN → not flagged as redundant Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
4c4fb08 to
c2ec8f5
Compare
Code Review ✅ Approved 2 resolved / 2 findingsReclassifies Bean Validation ✅ 2 resolved✅ Quality: Bean Validation @NotNull FQN set duplicated across 3 files
✅ Bug: Reclassifying @NotNull may silently change untested SE rules
OptionsAuto-apply is off → Gitar will not commit updates to this branch. Comment with these commands to change the behavior for this request:
Was this helpful? React with 👍 / 👎 | Gitar |
|




javax.validation.constraints.NotNull and jakarta.validation.constraints.NotNull are runtime constraints, not static nullability guarantees. Removing both of them from nullability status configuration gives consistent, conservative treatment.
Rules fixed as a direct consequence: