Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Kill jsr-305 #4604

Merged
merged 18 commits into from
Apr 6, 2020
Merged

Kill jsr-305 #4604

merged 18 commits into from
Apr 6, 2020

Conversation

jtnord
Copy link
Member

@jtnord jtnord commented Mar 26, 2020

remove JSR-305 annotations from core.

See JENKINS-55973.

Proposed changelog entries

  • Developer: Switched bug detection annotations from JSR-305 to SpotBugs / net.jcp equivalents

Proposed upgrade guidelines

N/A

Submitter checklist

  • JIRA issue is well described
  • Changelog entries and upgrade guidelines are appropriate for the audience affected by the change (users or developer, depending on the change). Examples
    • Fill-in the Proposed changelog entries section only if there are breaking changes or other changes which may require extra steps from users during the upgrade
  • Appropriate autotests or explanation to why this change has no tests
  • For dependency updates: links to external changelogs and, if possible, full diffs

Desired reviewers

@mention

Maintainer checklist

Before the changes are marked as ready-for-merge:

  • There are at least 2 approvals for the pull request and no outstanding requests for change
  • Conversations in the pull request are over OR it is explicit that a reviewer does not block the change
  • Changelog entries in the PR title and/or Proposed changelog entries are correct
  • Proper changelog labels are set so that the changelog can be generated automatically
  • If the change needs additional upgrade steps from users, upgrade-guide-needed label is set and there is a Proposed upgrade guidelines section in the PR title. (example)
  • If it would make sense to backport the change to LTS, a JIRA issue should exist and be labeled as lts-candidate

@jtnord jtnord added the developer Changes which impact plugin developers label Mar 26, 2020
@jtnord jtnord requested a review from a team March 26, 2020 19:11
@jtnord
Copy link
Member Author

jtnord commented Mar 26, 2020

Not sure how we can prevent someone adding an annotation back in (esp when the jsr-305 annotations are used in dependencies (and we still would like spotbugs to detect issues with the use of those libraries...)

@timja
Copy link
Member

timja commented Mar 26, 2020

Not sure how we can prevent someone adding an annotation back in (esp when the jsr-305 annotations are used in dependencies (and we still would like spotbugs to detect issues with the use of those libraries...)

checkstyle can do it https://checkstyle.sourceforge.io/apidocs/com/puppycrawl/tools/checkstyle/checks/imports/IllegalImportCheck.html

@timja
Copy link
Member

timja commented Mar 26, 2020

Are you aware of: google/guava#2960 (comment) ?

@jtnord
Copy link
Member Author

jtnord commented Mar 27, 2020

checkstyle can do it https://checkstyle.sourceforge.io/apidocs/com/puppycrawl/tools/checkstyle/checks/imports/IllegalImportCheck.html

I was tying to avoid checkstyle - as that sounds from the outset like it would be more contentious to introduce - even with a single rule.. But I'll give it whirl and see what the feedback is

Are you aware of: google/guava#2960 (comment) ?

I am now :-) I think there is value in this PR as-is even if here could be another migration when that project comes to light and the tooling is updated to support it. (because we would be migrating from two sets of annotations not three)

@jtnord
Copy link
Member Author

jtnord commented Mar 27, 2020

@timja added checkstyle to prevent re-introduction.

@jtnord jtnord marked this pull request as ready for review March 27, 2020 11:09
Copy link
Member

@timja timja left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've done a cursory look through, but the diff is huge, one comment on checkstyle but non-blocking

<configuration>
<consoleOutput>true</consoleOutput>
<failsOnError>true</failsOnError>
<!-- define here because checkstyle and multi module is a PITA -->
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

would be nice to have this in a file,
here's an example of how we got it working in multi module with jcasc:
https://github.com/jenkinsci/configuration-as-code-plugin/blob/master/pom.xml#L82

non-blocking though

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the pointer.
Given I have no idea if tools (eclipse intellij netbeans etc) all cope with that correctly (given it is set by the mvn wrapper) - and not everyone imports all the projects in a multi module setup, I'll stick which this for now as I know it to work.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Justification for rejecting this feedback seems weak. Done in #6552.

@jtnord jtnord requested review from a team March 30, 2020 18:47
@jglick
Copy link
Member

jglick commented Mar 30, 2020

Not sure how we can prevent someone adding an annotation back in

Add to bom a dependencyManagement entry pinning that artifact at a visibly bogus version. Which is probably how we should be handling javax.servlet:servlet-api, rather than using the [0] trick.

Copy link
Member

@jglick jglick left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For the benefit of NetBeans users, please

diff --git core/src/main/resources/META-INF/upgrade/JSR-305.hint core/src/main/resources/META-INF/upgrade/JSR-305.hint
new file mode 100644
index 0000000000..14c9a4227c
--- /dev/null
+++ core/src/main/resources/META-INF/upgrade/JSR-305.hint
@@ -0,0 +1,3 @@
+javax.annotation.CheckForNull => edu.umd.cs.findbugs.annotations.CheckForNull;;
+javax.annotation.Nonnull => edu.umd.cs.findbugs.annotations.NonNull;;
+javax.annotation.Nullable => edu.umd.cs.findbugs.annotations.Nullable;;

@@ -1,4 +1,3 @@
<?xml version="1.0" encoding="UTF-8"?>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why? Please revert.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lord knows.. I edited this file via eclipse dependency panel and not by hand.

Copy link
Contributor

@jeffret-b jeffret-b left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm in favor of this cleanup. I also did a cursory review of some of the files. Everything I saw looked good. I didn't review everything though.

@jtnord
Copy link
Member Author

jtnord commented Mar 30, 2020

Not sure how we can prevent someone adding an annotation back in

Add to bom a dependencyManagement entry pinning that artifact at a visibly bogus version. Which is probably how we should be handling javax.servlet:servlet-api, rather than using the [0] trick.

handled by checkstyle at the import level. want to keep them available for third party libs that use them.

MarkEWaite added a commit to MarkEWaite/jenkins.io that referenced this pull request May 4, 2020
Refer to jenkinsci/jenkins#4604 and
https://issues.jenkins-ci.org/browse/JENKINS-55973 for the rationale.

Replaces the deprecated javax.annotations references with non-deprecated
references to the spotbugs annotations package.

The deprecated javax.annotations were removed from Jenkins 2.231 and later.
basil added a commit to basil/swarm-plugin that referenced this pull request May 29, 2020
MarkEWaite added a commit to MarkEWaite/basic-branch-build-strategies-plugin that referenced this pull request Nov 24, 2021
The parent pom provides spotbugs reports by default.  Let's use spotbugs
annotations because they are used in other Jenkins plugins and in
Jenkins core.

See https://issues.jenkins.io/browse/JENKINS-55973 and
jenkinsci/jenkins#4604
jamietanna added a commit to jenkinsci/job-dsl-plugin that referenced this pull request Jan 1, 2022
Replace JSR305 annotations with SpotBugs annotations

As of jenkinsci/jenkins#4604, core switched from JSR 305 to SpotBugs
annotations. As of jenkinsci/plugin-pom#467 the plugin parent POM no
longer delivers JSR 305.

Therefore, we should make sure that we remove our reliance on this to
prevent breakages for folks in the future.
@offa offa mentioned this pull request Jun 24, 2022
6 tasks
MarkEWaite added a commit to MarkEWaite/basic-branch-build-strategies-plugin that referenced this pull request Oct 20, 2022
The parent pom provides spotbugs reports by default.  Let's use spotbugs
annotations because they are used in other Jenkins plugins and in
Jenkins core.

See https://issues.jenkins.io/browse/JENKINS-55973 and
jenkinsci/jenkins#4604
zhan9san pushed a commit to jenkinsci/basic-branch-build-strategies-plugin that referenced this pull request Oct 20, 2022
* Show user docs on plugins.jenkins.io

The current documentation link on plugins.jenkins.io is broken

https://plugins.jenkins.io/basic-branch-build-strategies/

This change will fix that broken link and replace it with the user
documentation the next time the plugin is released.  The user
documentation is quite good and will help users much better than the
broken link from the plugins page.

* Use spotbugs annotations instead of javax annotations

The parent pom provides spotbugs reports by default.  Let's use spotbugs
annotations because they are used in other Jenkins plugins and in
Jenkins core.

See https://issues.jenkins.io/browse/JENKINS-55973 and
jenkinsci/jenkins#4604

* Use Hamcrest assertThat, not JUnit deprecated assertThat

https://junit.org/junit4/javadoc/4.13/org/junit/Assert.html#assertThat(java.lang.String,%20T,%20org.hamcrest.Matcher)

* Remove unused imports

* Remove two more unused imports

* Cleanup and migrate docs to github

* Address review feedback

* Fix broken link to contributing doc

* Address typo in CHANGES.adoc

Co-authored-by: res0nance <[email protected]>
Co-authored-by: Stargator <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
developer Changes which impact plugin developers ready-for-merge The PR is ready to go, and it will be merged soon if there is no negative feedback
Projects
None yet
Development

Successfully merging this pull request may close these issues.

9 participants