Skip to content

Commit 71fef5c

Browse files
authored
Merge pull request jenkins-infra#1504 from jonesbusy/feature/word-utils
Migrate WordUtils to commons text
2 parents 0a325dc + 90135ad commit 71fef5c

2 files changed

Lines changed: 25 additions & 0 deletions

File tree

plugin-modernizer-core/src/main/resources/META-INF/rewrite/recipes.yml

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -219,6 +219,12 @@ recipeList:
219219
artifactId: commons-text-api
220220
version: latest.release
221221
onlyIfUsing: org.apache.commons.lang.StringEscapeUtils
222+
# migrate WordUtils to Commons Text
223+
- org.openrewrite.maven.AddDependency:
224+
groupId: io.jenkins.plugins
225+
artifactId: commons-text-api
226+
version: latest.release
227+
onlyIfUsing: org.apache.commons.text.WordUtils
222228
- org.openrewrite.java.ChangeType:
223229
oldFullyQualifiedTypeName: org.apache.commons.lang3.StringEscapeUtils
224230
newFullyQualifiedTypeName: org.apache.commons.text.StringEscapeUtils
@@ -228,6 +234,9 @@ recipeList:
228234
- org.openrewrite.java.ChangeMethodName:
229235
methodPattern: "*..StringEscapeUtils escapeJavaScript(java.lang.String)"
230236
newMethodName: escapeEcmaScript
237+
- org.openrewrite.java.ChangeType:
238+
oldFullyQualifiedTypeName: org.apache.commons.lang3.WordUtils
239+
newFullyQualifiedTypeName: org.apache.commons.text.WordUtils
231240
---
232241
type: specs.openrewrite.org/v1beta/recipe
233242
name: io.jenkins.tools.pluginmodernizer.MigrateToJenkinsBaseLineProperty

plugin-modernizer-core/src/test/java/io/jenkins/tools/pluginmodernizer/core/recipes/DeclarativeRecipesTest.java

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3459,6 +3459,22 @@ public static String escapeEcmaScript(String input) {
34593459
// language=java
34603460
java("""
34613461
package org.apache.commons.lang;
3462+
public class WordUtils {
3463+
public static String capitalize(String input) {
3464+
return input;
3465+
}
3466+
}
3467+
""", """
3468+
package org.apache.commons.text;
3469+
public class WordUtils {
3470+
public static String capitalize(String input) {
3471+
return input;
3472+
}
3473+
}
3474+
"""),
3475+
// language=java
3476+
java("""
3477+
package org.apache.commons.lang;
34623478
public class StringUtils {}
34633479
""", """
34643480
package org.apache.commons.lang3;

0 commit comments

Comments
 (0)