Skip to content

Conversation

@MarkEWaite
Copy link
Contributor

Replace JSR-305 annotations with spotbugs annotations

Annotations for Nonnull, CheckForNull, and several others were proposed for Java as part of dormant Java specification request JSR-305. The proposal never became a part of standard Java.

Jenkins plugins should switch from using JSR-305 annotations to use Spotbugs annotations that provide the same semantics.

The mailing list discussion at https://groups.google.com/g/jenkinsci-dev/c/uE1wwtVi1W0/m/gLxdEJmlBQAJ describes the affected annotations and why they should be replaced with annotations that are actively maintained.

An OpenRewrite recipe https://docs.openrewrite.org/recipes/jenkins/javaxannotationstospotbugs provides this upgrade, though it upgraded the Priority annotation and that annotation needs to remain because it is used by RestEasy.

Testing done

Confirmed that automated tests pass.

Submitter checklist

  • Make sure you are opening from a topic/feature/bugfix branch (right side) and not your main branch!
  • Ensure that the pull request title represents the desired changelog entry
  • Please describe what you did
  • Link to relevant issues in GitHub or Jira
  • Link to relevant pull requests, esp. upstream and downstream changes
  • Ensure you have provided tests - that demonstrates feature works or fixes the issue

Annotations for Nonnull, CheckForNull, and several others were proposed
for Java as part of dormant Java specification request JSR-305. The
proposal never became a part of standard Java.

Jenkins plugins should switch from using JSR-305 annotations to use
Spotbugs annotations that provide the same semantics.

The  mailing list discussion at
https://groups.google.com/g/jenkinsci-dev/c/uE1wwtVi1W0/m/gLxdEJmlBQAJ
describes the affected annotations and why they should be replaced with
annotations that are actively maintained.

An OpenRewrite recipe
https://docs.openrewrite.org/recipes/jenkins/javaxannotationstospotbugs
provides this upgrade, though it upgraded the Priority annotation and
that annotation needs to remain because it is used by RestEasy.
@MarkEWaite MarkEWaite added the chore Reduces maintenance effort by changes not directly visible to users label Feb 4, 2025
@MarkEWaite MarkEWaite merged commit e86827e into jenkinsci:master Feb 4, 2025
17 checks passed
@MarkEWaite MarkEWaite deleted the use-spotbugs-annotations-for-nullness branch February 4, 2025 02:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

chore Reduces maintenance effort by changes not directly visible to users

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant