Skip to content

Fix unrecognized JSpecify nullable annotation locations - #51555

Merged
wilkinsona merged 1 commit into
spring-projects:4.0.xfrom
vlsi:codex/fix-jspecify-nullable-locations
Sep 4, 2026
Merged

wilkinsona merged 1 commit into
spring-projects:4.0.xfrom
vlsi:codex/fix-jspecify-nullable-locations

Conversation

@vlsi

@vlsi vlsi commented Sep 3, 2026

Copy link
Copy Markdown
Contributor

Why

NullAway’s new JSpecifyUnrecognizedAnnotationLocation checker found five @Nullable annotations in locations that JSpecify does not recognize. Those annotations do not express the intended nullness to JSpecify-aware tools.

What

Move wildcard annotations onto their bounds, where JSpecify recognizes them, and remove annotations from a cast and a local-variable root type where the enclosing declarations already express or infer the nullable result.

How to verify

  • Built all compileJava tasks with the NullAway snapshot from Add a check for nullness annotations in locations JSpecify does not recognize uber/NullAway#1787 and JSpecifyUnrecognizedAnnotationLocation configured at ERROR severity.
  • ./gradlew :core:spring-boot:test --tests org.springframework.boot.context.properties.PropertyMapperTests
  • ./gradlew :module:spring-boot-jpa:test --tests org.springframework.boot.jpa.EntityManagerFactoryBuilderTests
  • ./gradlew :module:spring-boot-webflux:test --tests org.springframework.boot.webflux.actuate.endpoint.web.AbstractWebFluxEndpointHandlerMappingTests

@spring-projects-issues spring-projects-issues added the status: waiting-for-triage An issue we've not yet triaged label Sep 3, 2026
@vlsi

vlsi commented Sep 3, 2026

Copy link
Copy Markdown
Contributor Author

Note: for backward compatibility reasons, the checker will be under "suggestion" severity, so if you like to have those as warnings or errors, you would need to adjust JSpecifyUnrecognizedAnnotationLocation checker to ERROR severity in your build scripts.

Note: Spring Framework passes the new checker just fine, no changes required.

@wilkinsona wilkinsona added type: task A general task and removed status: waiting-for-triage An issue we've not yet triaged labels Sep 4, 2026
@wilkinsona wilkinsona added this to the 4.0.x milestone Sep 4, 2026
@wilkinsona wilkinsona self-assigned this Sep 4, 2026
Signed-off-by: Vladimir Sitnikov <sitnikov.vladimir@gmail.com>

See spring-projectsgh-51555
@wilkinsona
wilkinsona changed the base branch from main to 4.0.x September 4, 2026 08:51
@wilkinsona
wilkinsona force-pushed the codex/fix-jspecify-nullable-locations branch from b58f0af to ff30867 Compare September 4, 2026 08:51
@wilkinsona wilkinsona modified the milestones: 4.0.x, 4.0.9 Sep 4, 2026
@wilkinsona
wilkinsona merged commit 6114f57 into spring-projects:4.0.x Sep 4, 2026
1 check passed
@wilkinsona

Copy link
Copy Markdown
Member

The changes to EntityManagerFactoryBuilder have been applied in c38c15b as part of merging this forwards into 4.1.x.

@wilkinsona

Copy link
Copy Markdown
Member

Thanks very much, @vlsi.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

type: task A general task

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants