Skip to content

update deprecated org.springframework.lang.Nullable for Spring Boot 4#23316

Draft
raichuchuchu wants to merge 3 commits intoOpenAPITools:masterfrom
raichuchuchu:feature/jspecify_Nullable
Draft

update deprecated org.springframework.lang.Nullable for Spring Boot 4#23316
raichuchuchu wants to merge 3 commits intoOpenAPITools:masterfrom
raichuchuchu:feature/jspecify_Nullable

Conversation

@raichuchuchu
Copy link
Contributor

@raichuchuchu raichuchuchu commented Mar 23, 2026

PR checklist

  • Read the contribution guidelines.
  • Pull Request title clearly describes the work in the pull request and Pull Request description provides details about how to validate the work. Missing information here may result in delayed response from the community.
  • Run the following to build the project and update samples:
    ./mvnw clean package || exit
    ./bin/generate-samples.sh ./bin/configs/*.yaml || exit
    ./bin/utils/export_docs_generators.sh || exit
    
    (For Windows users, please run the script in WSL)
    Commit all changed files.
    This is important, as CI jobs will verify all generator outputs of your HEAD commit as it would merge with master.
    These must match the expectations made by your contribution.
    You may regenerate an individual generator by passing the relevant config(s) as an argument to the script, for example ./bin/generate-samples.sh bin/configs/java*.
    IMPORTANT: Do NOT purge/delete any folders/files (e.g. tests) when regenerating the samples as manually written tests may be removed.
  • File the PR against the correct branch: master (upcoming 7.x.0 minor release - breaking changes with fallbacks), 8.0.x (breaking changes without fallbacks)
  • If your PR solves a reported issue, reference it using GitHub's linking syntax (e.g., having "fixes #123" present in the PR description)
  • If your PR is targeting a particular programming language, @mention the technical committee members, so they are more likely to review the pull request.

Summary by cubic

Switches Spring generators to use org.jspecify.annotations.Nullable when targeting Spring Boot 4, replacing deprecated org.springframework.lang.Nullable. Also fixes CppHttplibServer test package names and refreshes Java client samples.

  • New Features

    • SpringCodegen: Nullable now resolves to org.jspecify.annotations.Nullable when useSpringBoot4 is enabled; otherwise it remains org.springframework.lang.Nullable.
  • Bug Fixes

    • Fixed incorrect package declarations in cpphttplibserver tests.
    • Regenerated restclient-enum-in-multipart Java client samples to match current generator output.

Written for commit 68fc0c9. Summary will update on new commits.

files.

fix: update sample `restclient-enum-in-multipart`
Spring Boot 4

- Update import mapping for Nullable to
org.jspecify.annotations.Nullable when useSpringBoot4 is enabled.
@jpfinne
Copy link
Contributor

jpfinne commented Mar 23, 2026

@raichuchuchu there is already #23256 to generate jspecify nullable annotations. Can you review it?

@raichuchuchu
Copy link
Contributor Author

Hello,

After submitting this draft, I happened to be reviewing #23256. I fully agree with the transition to org.jspecify.annotations.Nullable via useJspecify to replace the deprecated org.springframework.lang.Nullable.

That said, I’ve noticed some edge cases with the JSpecify annotations, so I am also considering whether jakarta.annotation.Nullable might be a viable alternative. I plan to wait until #23256 is merged before further updating my draft. In the meantime, I’d like to take some time to test the changes from #23256 within a real Spring Boot 4 project.

@jpfinne
Copy link
Contributor

jpfinne commented Mar 24, 2026

@raichuchuchu if you want to use jakarta nullable, just configure it. For example in the maven plugin

<importMappings>
   <importMapping>Nullable=org.jakarta.annotations.Nullable</importMapping>
</importMappings>

So no need for an extra config. Maybe better documentation is enough

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants