Replace JSR-305 annotations with Spotbugs annotations
This site is the new docs site currently being tested. For the actual docs in use please go to https://www.jenkins.io/doc. |
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.
Refer to the mailing list discussion from James Nord.
Create a branch
In a local copy of your fork of the plugin repository create a git branch for your work with the command:
git checkout -b {task-identifier} master
Migrate Nonnull
Replace imports of javax.annotation.Nonnull
with imports of edu.umd.cs.findbugs.annotations.NonNull
.
Replace references to Nonnull
with NonNull
.
Migrate CheckForNull
Replace imports of javax.annotation.CheckForNull
with imports of edu.umd.cs.findbugs.annotations.CheckForNull
.
Remove unused dependencies from pom file
If the pom file includes a jsr305
dependency, remove it.
The spotbugs annotations are provided by the parent pom.
Compile the plugin
Use Apache Maven to compile the plugin and run its automated tests with the command:
mvn clean verify
Confirm that JSR-305 is not mentioned in the compiler output and that compilation succeeds.
Create a pull request
Commit that change:
git add {modified-files}
git commit -m "{task-description}"
Push the change to GitHub:
git push origin --set-upstream {task-identifier}
Total 0 (delta 0), reused 0 (delta 0), pack-reused 0 remote: remote: Create a pull request for '{task-identifier}' on GitHub by visiting: remote: https://github.com/user/your-plugin/pull/new/{task-identifier} remote: To github.com:user/your-plugin.git * [new branch] {task-identifier} -> {task-identifier} Branch '{task-identifier}' tracking remote branch '{task-identifier}'.
Notice that the output of the command includes the URL, which can be used to open a pull request. Copy that URL in your web browser and submit a pull request.