Replace JSR-305

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 fix-jsr-305 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 and test

Compile and test the updated code with the command:

$ mvn clean verify

Create a pull request

Commit that change:

$ git add src/main/ src/test/
$ git commit -m "Fix JSR-305 annotations"

Push the change to GitHub:

$ git push origin --set-upstream fix-jsr-305
Total 0 (delta 0), reused 0 (delta 0), pack-reused 0
remote:
remote: Create a pull request for 'fix-jsr-305' on GitHub by visiting:
remote: https://github.com/user/your-plugin/pull/new/fix-jsr-305
remote:
To github.com:user/your-plugin.git
 * [new branch]      fix-jsr-305 -> fix-jsr-305
Branch 'fix-jsr-305' tracking remote branch 'fix-jsr-305'.

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.