Skip to content
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

Nullability consistency for getter and setter #29573

Closed
jlous opened this issue Nov 25, 2022 · 3 comments
Closed

Nullability consistency for getter and setter #29573

jlous opened this issue Nov 25, 2022 · 3 comments
Assignees
Labels
in: core Issues in core modules (aop, beans, core, context, expression)

Comments

@jlous
Copy link

jlous commented Nov 25, 2022

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.

@spring-projects-issues spring-projects-issues added the status: waiting-for-triage An issue we've not yet triaged or decided on label Nov 25, 2022
@sdeleuze sdeleuze self-assigned this Nov 27, 2022
@rstoyanchev rstoyanchev added the in: core Issues in core modules (aop, beans, core, context, expression) label Feb 9, 2023
@sdeleuze
Copy link
Contributor

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.

@sdeleuze sdeleuze added status: waiting-for-feedback We need additional information before we can continue and removed status: waiting-for-triage An issue we've not yet triaged or decided on labels Aug 23, 2023
@spring-projects-issues
Copy link
Collaborator

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.

@spring-projects-issues spring-projects-issues added the status: feedback-reminder We've sent a reminder that we need additional information before we can continue label Aug 30, 2023
@spring-projects-issues
Copy link
Collaborator

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.

@spring-projects-issues spring-projects-issues closed this as not planned Won't fix, can't repro, duplicate, stale Sep 6, 2023
@spring-projects-issues spring-projects-issues removed status: waiting-for-feedback We need additional information before we can continue status: feedback-reminder We've sent a reminder that we need additional information before we can continue labels Sep 6, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
in: core Issues in core modules (aop, beans, core, context, expression)
Projects
None yet
Development

No branches or pull requests

4 participants