-
-
Notifications
You must be signed in to change notification settings - Fork 8.9k
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
Kill jsr-305 #4604
Conversation
…heckReturnValue/g
…gs.annotations.OverrideMustInvoke/g
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 |
Are you aware of: google/guava#2960 (comment) ? |
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
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) |
@timja added checkstyle to prevent re-introduction. |
There was a problem hiding this 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 --> |
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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.
Add to |
There was a problem hiding this 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"?> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why? Please revert.
There was a problem hiding this comment.
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.
There was a problem hiding this 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.
handled by checkstyle at the import level. want to keep them available for third party libs that use them. |
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.
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
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.
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
* 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]>
remove JSR-305 annotations from core.
See JENKINS-55973.
Proposed changelog entries
Proposed upgrade guidelines
N/A
Submitter checklist
Proposed changelog entries
section only if there are breaking changes or other changes which may require extra steps from users during the upgradeDesired reviewers
@mention
Maintainer checklist
Before the changes are marked as
ready-for-merge
:Proposed changelog entries
are correctupgrade-guide-needed
label is set and there is aProposed upgrade guidelines
section in the PR title. (example)lts-candidate