File tree Expand file tree Collapse file tree
main/resources/META-INF/rewrite
test/java/io/jenkins/tools/pluginmodernizer/core/recipes Expand file tree Collapse file tree Original file line number Diff line number Diff line change 311311 <artifactId >hamcrest</artifactId >
312312 <version >3.0</version >
313313 </dependency >
314+ <!-- JSR305 annotations -->
315+ <dependency >
316+ <groupId >javax.annotation</groupId >
317+ <artifactId >javax.annotation-api</artifactId >
318+ <version >1.3.2</version >
319+ </dependency >
320+ <dependency >
321+ <groupId >com.google.code.findbugs</groupId >
322+ <artifactId >jsr305</artifactId >
323+ <version >3.0.2</version >
324+ </dependency >
314325 </artifactItems >
315326 </configuration >
316327 </execution >
Original file line number Diff line number Diff line change @@ -734,11 +734,17 @@ tags: ['chore']
734734recipeList :
735735 - io.jenkins.tools.pluginmodernizer.core.recipes.MigrateTomakehurstToWiremock
736736---
737- ---
738737type : specs.openrewrite.org/v1beta/recipe
739738name : io.jenkins.tools.pluginmodernizer.JavaxAnnotationsToSpotbugs
740739displayName : Migrate `javax.annotations` to SpotBugs annotations.
741740description : SpotBugs is the [preferred replacement](https://www.jenkins.io/doc/developer/tutorial-improve/replace-jsr-305-annotations/) of JSR-305 annotations for Jenkins plugins.
742741tags : ['chore']
743742recipeList :
744- - org.openrewrite.jenkins.JavaxAnnotationsToSpotbugs
743+ - org.openrewrite.java.ChangeType :
744+ oldFullyQualifiedTypeName : javax.annotation.Nonnull
745+ newFullyQualifiedTypeName : edu.umd.cs.findbugs.annotations.NonNull
746+ ignoreDefinition : true
747+ - org.openrewrite.java.ChangePackage :
748+ oldPackageName : javax.annotation
749+ newPackageName : edu.umd.cs.findbugs.annotations
750+ recursive : false
Original file line number Diff line number Diff line change @@ -783,8 +783,21 @@ void upgradeToRecommendCoreVersionTest() {
783783 import hudson.util.IOException2;
784784 import java.io.File;
785785 import java.io.IOException;
786+ import javax.annotation.CheckForNull;
787+ import javax.annotation.Nonnull;
786788
787789 public class Foo {
790+
791+ @CheckForNull
792+ public String getSomething() {
793+ return "something";
794+ }
795+
796+ @Nonnull
797+ public String getOther() {
798+ return "something";
799+ }
800+
788801 public static void main(String[] args) {
789802 try {
790803 parseFile(new File("invalid.xml"));
@@ -802,10 +815,23 @@ private static void parseFile(File file) throws IOException2 {
802815 }
803816 }
804817 """ , """
818+ import edu.umd.cs.findbugs.annotations.NonNull;
805819 import java.io.File;
806820 import java.io.IOException;
821+ import edu.umd.cs.findbugs.annotations.CheckForNull;
807822
808823 public class Foo {
824+
825+ @CheckForNull
826+ public String getSomething() {
827+ return "something";
828+ }
829+
830+ @NonNull
831+ public String getOther() {
832+ return "something";
833+ }
834+
809835 public static void main(String[] args) {
810836 try {
811837 parseFile(new File("invalid.xml"));
Original file line number Diff line number Diff line change 9595 "io.jenkins.tools.pluginmodernizer.MigrateTomakehurstToWiremock" ,
9696 "io.jenkins.tools.pluginmodernizer.MigrateCommonsLang2ToLang3AndCommonText" ,
9797 "io.jenkins.tools.pluginmodernizer.RemoveOldJavaVersionForModernJenkins" ,
98- "io.jenkins.tools.pluginmodernizer.SwitchToRenovate"
98+ "io.jenkins.tools.pluginmodernizer.SwitchToRenovate" ,
99+ "io.jenkins.tools.pluginmodernizer.JavaxAnnotationsToSpotbugs"
99100]
100101
101102def validate_metadata (file_path ):
You can’t perform that action at this time.
0 commit comments