Where possible, setter-getter-pairs where the getter is @Nullable
should also tag the setter argument as @Nullable
.
Mismatched nullabillity breaks property-style access from Kotlin. This must be so, because treating such a pair as a consistent property that is either nullable or not would result in unexpected NPEs during either writing or reading respectively
There are of course cases where setting to null should be disallowed, but usually (e.g. SimpleMailMessage) the setters simply assign to a backing variable, and the consequences of doing so with null are no different than leaving it uninitialised, and should be explicitly allowed.
Comment From: sdeleuze
Indeed, and we had various refinements in that spirit like #29139 for SimpleMailMessage
, but for now we don't have a way to detect that automatically, so I would be interested to know if you have identified specific classes that need this refinement. Otherwise, I would just suggest that we process such refinements when raised in specific issues or PRs.
Comment From: spring-projects-issues
If you would like us to look at this issue, please provide the requested information. If the information is not provided within the next 7 days this issue will be closed.
Comment From: spring-projects-issues
Closing due to lack of requested feedback. If you would like us to look at this issue, please provide the requested information and we will re-open the issue.