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

Refine null-safety with NullAway build-time checks #32475

Closed
sdeleuze opened this issue Mar 18, 2024 · 0 comments
Closed

Refine null-safety with NullAway build-time checks #32475

sdeleuze opened this issue Mar 18, 2024 · 0 comments
Assignees
Labels
type: enhancement A general enhancement
Milestone

Comments

@sdeleuze
Copy link
Contributor

sdeleuze commented Mar 18, 2024

As discussed with the JSpecify working group, the goal of this issue is to introduce null-safety checks at build-time using NullAway and the related Error Prone Gradle plugin and refine Spring null-safety annotations accordingly.

Unlike #28797, the purpose of this issue is to continue to leverage JSR 305 annotations. That said, such formal build-time checks will likely ease a potential transition to a different null-safety mechanism (JSpecify or at Java platform level) in the future.

See this draft commit that enables those null-checks on spring-core and generates 41 errors that will likely to lead null-safety refinements.

@sdeleuze sdeleuze added the type: enhancement A general enhancement label Mar 18, 2024
@sdeleuze sdeleuze added this to the 6.2.0-M1 milestone Mar 18, 2024
@sdeleuze sdeleuze self-assigned this Mar 18, 2024
jhoeller added a commit that referenced this issue Mar 18, 2024
jhoeller added a commit that referenced this issue Mar 18, 2024
sdeleuze added a commit to sdeleuze/spring-framework that referenced this issue Mar 19, 2024
sdeleuze added a commit to sdeleuze/spring-framework that referenced this issue Mar 19, 2024
This commit introduces null-safety checks for spring-core at build-time
in order to validate the consistency of Spring null-safety annotations
and generate errors when inconsistencies are detected during a build
(similar to what is done with Checkstyle).

In order to make that possible, this commit also introduces a new
org.springframework.lang.Contract annotation inspired from
org.jetbrains.annotations.Contract, which allows to specify semantics
of methods like Assert#notNull in order to prevent artificial
additional null checks in Spring Framework code base.

This commit only checks org.springframework.core package, follow-up
commits will also extend the analysis to other modules, after related
null-safety refinements.

See spring-projectsgh-32475
sdeleuze added a commit to sdeleuze/spring-framework that referenced this issue Mar 20, 2024
sdeleuze added a commit to sdeleuze/spring-framework that referenced this issue Mar 20, 2024
sdeleuze added a commit to sdeleuze/spring-framework that referenced this issue Mar 20, 2024
sdeleuze added a commit that referenced this issue Mar 20, 2024
sdeleuze added a commit to sdeleuze/spring-framework that referenced this issue Mar 22, 2024
sdeleuze added a commit to sdeleuze/spring-framework that referenced this issue Mar 22, 2024
sdeleuze added a commit to sdeleuze/spring-framework that referenced this issue Mar 22, 2024
sdeleuze added a commit to sdeleuze/spring-framework that referenced this issue Mar 22, 2024
sdeleuze added a commit to sdeleuze/spring-framework that referenced this issue Mar 25, 2024
sdeleuze added a commit to sdeleuze/spring-framework that referenced this issue Mar 25, 2024
sdeleuze added a commit to sdeleuze/spring-framework that referenced this issue Mar 25, 2024
sdeleuze added a commit to sdeleuze/spring-framework that referenced this issue Mar 25, 2024
sdeleuze added a commit to sdeleuze/spring-framework that referenced this issue Mar 25, 2024
sdeleuze added a commit to sdeleuze/spring-framework that referenced this issue Mar 25, 2024
sdeleuze added a commit to sdeleuze/spring-framework that referenced this issue Mar 26, 2024
This commit refines the null-safety in:
 - spring-jdbc
 - spring-r2dbc
 - spring-orm
 - spring-beans
 - spring-aop

See spring-projectsgh-32475
sdeleuze added a commit to sdeleuze/spring-framework that referenced this issue Mar 26, 2024
This commit enables null-safety build-time checks in:
 - spring-jdbc
 - spring-r2dbc
 - spring-orm
 - spring-beans
 - spring-aop

See spring-projectsgh-32475
sdeleuze added a commit to sdeleuze/spring-framework that referenced this issue Mar 26, 2024
This commit enables null-safety build-time checks in:
 - spring-jdbc
 - spring-r2dbc
 - spring-orm
 - spring-beans
 - spring-aop

See spring-projectsgh-32475
sdeleuze added a commit to sdeleuze/spring-framework that referenced this issue Mar 26, 2024
This commit refines the null-safety in all remaining modules
except spring-test.

See spring-projectsgh-32475
sdeleuze added a commit to sdeleuze/spring-framework that referenced this issue Mar 26, 2024
This commit enables null-safety build-time checks in
all remaining modules except spring-test.

See spring-projectsgh-32475
sdeleuze added a commit to sdeleuze/spring-framework that referenced this issue Mar 26, 2024
sdeleuze added a commit to sdeleuze/spring-framework that referenced this issue Apr 5, 2024
sdeleuze added a commit to sdeleuze/spring-framework that referenced this issue Apr 5, 2024
sdeleuze added a commit that referenced this issue Apr 5, 2024
sdeleuze added a commit to sdeleuze/spring-framework that referenced this issue Apr 5, 2024
This commit reverts some null-safety changes which make sense
on main but are too impactful for 6.1.x for Kotlin developers
using -Xjsr305=strict.

See spring-projectsgh-32475
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: enhancement A general enhancement
Projects
None yet
Development

No branches or pull requests

2 participants