diff --git a/src/main/java/org/openrewrite/java/migrate/apache/commons/io/ApacheCommonsFileUtils.java b/src/main/java/org/openrewrite/java/migrate/apache/commons/io/ApacheCommonsFileUtils.java index f917ea11a0..8cb11bfc84 100644 --- a/src/main/java/org/openrewrite/java/migrate/apache/commons/io/ApacheCommonsFileUtils.java +++ b/src/main/java/org/openrewrite/java/migrate/apache/commons/io/ApacheCommonsFileUtils.java @@ -40,7 +40,7 @@ File after(String name) { } // NOTE: java: reference to compile is ambiguous; methods P3 & F3 match -// private static class Write { +// public static class Write { // @BeforeTemplate // void before(File file, CharSequence data, Charset cs) throws Exception { // FileUtils.write(file, data, cs); diff --git a/src/main/java/org/openrewrite/java/migrate/apache/commons/lang/ApacheCommonsStringUtils.java b/src/main/java/org/openrewrite/java/migrate/apache/commons/lang/ApacheCommonsStringUtils.java index c3cf9ba36e..6643c3cfa1 100644 --- a/src/main/java/org/openrewrite/java/migrate/apache/commons/lang/ApacheCommonsStringUtils.java +++ b/src/main/java/org/openrewrite/java/migrate/apache/commons/lang/ApacheCommonsStringUtils.java @@ -59,7 +59,7 @@ String after(String s) { } //NOTE: The test for this recipe fails, I think it could be due to a `rewrite-templating` bug - //private static class Chomp { + //public static class Chomp { // @BeforeTemplate // String before(String s) { // return StringUtils.chomp(s); @@ -72,7 +72,7 @@ String after(String s) { //} // NOTE: fails with __P__. inserted - //private static class Chop { + //public static class Chop { // @BeforeTemplate // String before(String s) { // return StringUtils.chop(s); @@ -88,7 +88,7 @@ String after(String s) { //} // NOTE: not sure if accurate replacement - //private static class Contains { + //public static class Contains { // @BeforeTemplate // boolean before(String s, String search) { // return StringUtils.contains(s, search); @@ -101,7 +101,7 @@ String after(String s) { //} // NOTE: Requires Java 9+ for s.chars() - //private static class CountMatchesChar { + //public static class CountMatchesChar { // @BeforeTemplate // int before(String s, char pattern) { // return StringUtils.countMatches(s, pattern); @@ -159,7 +159,7 @@ String after(String s) { } // NOTE: unlikely to go over well due to added complexity - //private static class EndsWithIgnoreCase { + //public static class EndsWithIgnoreCase { // @BeforeTemplate // boolean before(String s, String suffix) { // return StringUtils.endsWithIgnoreCase(s, suffix); @@ -203,7 +203,7 @@ boolean after(String s, String other) { } // NOTE: unlikely to go over well due to added complexity - //private static class IndexOfAny { + //public static class IndexOfAny { // @BeforeTemplate // int before(String s, String searchChars) { // return StringUtils.indexOfAny(s, searchChars); @@ -221,7 +221,7 @@ boolean after(String s, String other) { //} // NOTE: not sure if accurate replacement - //private static class IsAlphanumericSpace { + //public static class IsAlphanumericSpace { // @BeforeTemplate // boolean before(String s) { // return StringUtils.isAlphanumericSpace(s); @@ -234,7 +234,7 @@ boolean after(String s, String other) { // `chars()` is only in Java 9+ - //private static class IsAlphanumeric { + //public static class IsAlphanumeric { // @BeforeTemplate // boolean before(@Matches(RepeatableArgumentMatcher.class) String s) { // return StringUtils.isAlphanumeric(s); @@ -247,7 +247,7 @@ boolean after(String s, String other) { //} // NOTE: not sure if accurate replacement - //private static class IsAlphaSpace { + //public static class IsAlphaSpace { // @BeforeTemplate // boolean before(String s) { // return StringUtils.isAlphaSpace(s); @@ -259,7 +259,7 @@ boolean after(String s, String other) { // } //} - //private static class StripAll { + //public static class StripAll { // @BeforeTemplate // String[] before(String[] s) { // return StringUtils.stripAll(s); @@ -274,7 +274,7 @@ boolean after(String s, String other) { //} // `chars()` is only in Java 9+ - //private static class IsAlpha { + //public static class IsAlpha { // @BeforeTemplate // boolean before(@Matches(RepeatableArgumentMatcher.class) String s) { // return StringUtils.isAlpha(s); @@ -287,7 +287,7 @@ boolean after(String s, String other) { //} // NOTE: better handled by `org.openrewrite.java.migrate.apache.commons.lang.IsNotEmptyToJdk` - //private static class IsEmpty { + //public static class IsEmpty { // @BeforeTemplate // boolean before(String s) { // return StringUtils.isEmpty(s); @@ -322,7 +322,7 @@ boolean after(String s, String other) { // } //} - //private static class Join { + //public static class Join { // @BeforeTemplate // String before(String s) { // return StringUtils.join(s); @@ -336,7 +336,7 @@ boolean after(String s, String other) { // NOTE: not sure if accurate replacement @SuppressWarnings("ConstantValue") - //private static class Left { + //public static class Left { // @BeforeTemplate // String before(String s, int l) { // return StringUtils.left(s, l); @@ -364,7 +364,7 @@ String after(String s) { } // NOTE: not sure if accurate replacement - //private static class Mid { + //public static class Mid { // @BeforeTemplate // String before(String s, int p, int l) { // return StringUtils.mid(s, p, l); @@ -377,7 +377,7 @@ String after(String s) { //} // NOTE: not sure if accurate replacement - //private static class Overlay { + //public static class Overlay { // @BeforeTemplate // String before(String s, int w, int l, String overlay) { // return StringUtils.overlay(s, overlay, w, l); @@ -390,7 +390,7 @@ String after(String s) { //} // NOTE: Similar issues to what LeftPad and RightPad have - //private static class Center { + //public static class Center { // @BeforeTemplate // String before(String s, int size) { // return StringUtils.center(s, size); @@ -419,7 +419,7 @@ String after(String s, String end) { } } - //private static class Repeat { + //public static class Repeat { // @BeforeTemplate // String before(String s, int l) { // return StringUtils.repeat(s, l); @@ -432,7 +432,7 @@ String after(String s, String end) { //} // NOTE: requires dedicated recipe to clean up `Pattern.quote(",")` - //private static class ReplaceOnce { + //public static class ReplaceOnce { // @BeforeTemplate // String before(String s, String search, String replacement) { // return StringUtils.replaceOnce(s, search, replacement); @@ -477,7 +477,7 @@ String after(String s) { } // NOTE: not sure if accurate replacement - //private static class Right { + //public static class Right { // @BeforeTemplate // String before(String s, int l) { // return StringUtils.right(s, l); @@ -505,7 +505,7 @@ String[] after(String s) { } // NOTE: requires dedicated recipe to clean up `Pattern.quote(",")` - //private static class SplitSeparator { + //public static class SplitSeparator { // @BeforeTemplate // String[] before(String s, String arg) { // return StringUtils.split(s, arg); @@ -518,7 +518,7 @@ String[] after(String s) { //} // NOTE: different semantics in handling max=0 to discard trailing empty strings - //private static class SplitSeparatorMax { + //public static class SplitSeparatorMax { // @BeforeTemplate // String[] before(String s, String arg, int max) { // return StringUtils.split(s, arg, max); @@ -546,7 +546,7 @@ String after(String s) { } // NOTE: suffix is a set of characters, not a complete literal string - //private static class StripEnd { + //public static class StripEnd { // @BeforeTemplate // String before(String s, String suffix) { // return StringUtils.stripEnd(s, suffix); @@ -559,7 +559,7 @@ String after(String s) { //} // NOTE: suffix is a set of characters, not a complete literal string - //private static class StripStart { + //public static class StripStart { // @BeforeTemplate // String before(String s, String chars) { // return StringUtils.stripStart(s, chars); @@ -572,7 +572,7 @@ String after(String s) { //} // NOTE: not sure if accurate replacement - //private static class StartsWith { + //public static class StartsWith { // @BeforeTemplate // boolean before(String s, String prefix) { // return StringUtils.startsWith(s, prefix); @@ -585,7 +585,7 @@ String after(String s) { //} // NOTE: Incorrect handling of before null/empty and separator null/empty - //private static class SubstringAfter { + //public static class SubstringAfter { // @BeforeTemplate // String before(String s, String sep) { // return StringUtils.substringAfter(s, sep); @@ -598,7 +598,7 @@ String after(String s) { //} // NOTE: Incorrect handling of negative values - //private static class Substring { + //public static class Substring { // @BeforeTemplate // String before(String s, int l, int w) { // return StringUtils.substring(s, l, w); @@ -611,7 +611,7 @@ String after(String s) { //} // NOTE: fails to account for isTitleCase - //private static class SwapCase { + //public static class SwapCase { // @BeforeTemplate // String before(String s, char sep) { // return StringUtils.swapCase(s); @@ -689,7 +689,7 @@ String after(String s) { } // NOTE: breaks on empty strings - //private static class Uncapitalize { + //public static class Uncapitalize { // @BeforeTemplate // String before(String s) { // return StringUtils.uncapitalize(s); diff --git a/src/main/java/org/openrewrite/java/migrate/lang/StringRules.java b/src/main/java/org/openrewrite/java/migrate/lang/StringRules.java index 3cf182651c..f377183182 100644 --- a/src/main/java/org/openrewrite/java/migrate/lang/StringRules.java +++ b/src/main/java/org/openrewrite/java/migrate/lang/StringRules.java @@ -25,7 +25,7 @@ public class StringRules { description = "Replace redundant `substring(..)` and `toString()` method calls with the `String` self." ) @SuppressWarnings("StringOperationCanBeSimplified") - static class RedundantCall { + public static class RedundantCall { @BeforeTemplate public String start(String string) { return string.substring(0, string.length()); @@ -51,7 +51,7 @@ public String self(String string) { name = "Replace `String.indexOf(String, 0)` with `String.indexOf(String)`", description = "Replace `String.indexOf(String str, int fromIndex)` with `String.indexOf(String)`.") @SuppressWarnings("StringOperationCanBeSimplified") - static class IndexOfString { + public static class IndexOfString { @BeforeTemplate public int indexOfZero(String string, String test) { return string.indexOf(test, 0); @@ -67,7 +67,7 @@ public int indexOf(String string, String test) { name = "Replace `String.indexOf(char, 0)` with `String.indexOf(char)`", description = "Replace `String.indexOf(char ch, int fromIndex)` with `String.indexOf(char)`.") @SuppressWarnings("StringOperationCanBeSimplified") - static class IndexOfChar { + public static class IndexOfChar { @BeforeTemplate public int indexOfZero(String string, char test) { return string.indexOf(test, 0); @@ -83,7 +83,7 @@ public int indexOf(String string, char test) { name = "Replace lower and upper case `String` comparisons with `String.equalsIgnoreCase(String)`", description = "Replace `String` equality comparisons involving `.toLowerCase()` or `.toUpperCase()` with `String.equalsIgnoreCase(String anotherString)`.") @SuppressWarnings("StringOperationCanBeSimplified") - static class UseEqualsIgnoreCase { + public static class UseEqualsIgnoreCase { @BeforeTemplate public boolean bothLowerCase(String string, String test) { return string.toLowerCase().equals(test.toLowerCase()); diff --git a/src/main/java/org/openrewrite/java/migrate/maven/shared/MavenSharedStringUtils.java b/src/main/java/org/openrewrite/java/migrate/maven/shared/MavenSharedStringUtils.java index ec7e3986d4..4550d2e35b 100644 --- a/src/main/java/org/openrewrite/java/migrate/maven/shared/MavenSharedStringUtils.java +++ b/src/main/java/org/openrewrite/java/migrate/maven/shared/MavenSharedStringUtils.java @@ -20,12 +20,15 @@ import org.apache.maven.shared.utils.StringUtils; import org.openrewrite.java.migrate.apache.commons.lang.RepeatableArgumentMatcher; import org.openrewrite.java.template.Matches; +import org.openrewrite.java.template.RecipeDescriptor; import java.util.Objects; @SuppressWarnings("ALL") public class MavenSharedStringUtils { - + @RecipeDescriptor( + name = "Replace `StringUtils.abbreviate(String, int)` with JDK internals", + description = "Replace Maven Shared `StringUtils.abbreviate(String str, int maxWidth)` with JDK internals.") public static class Abbreviate { @BeforeTemplate String before(@Matches(RepeatableArgumentMatcher.class) String s1, @@ -39,8 +42,11 @@ String after(String s, int width) { } } + @RecipeDescriptor( + name = "Replace `StringUtils.capitalise(String)` with JDK internals", + description = "Replace Maven Shared `StringUtils.capitalise(String str)` with JDK internals.") @SuppressWarnings("ConstantValue") - public static class Capitalize { + public static class Capitalise { @BeforeTemplate String before(@Matches(RepeatableArgumentMatcher.class) String s) { return StringUtils.capitalise(s); @@ -52,6 +58,9 @@ String after(String s) { } } + @RecipeDescriptor( + name = "Replace `StringUtils.defaultString(Object)` with JDK internals", + description = "Replace Maven Shared `StringUtils.defaultString(Object obj)` with JDK internals.") public static class DefaultString { @BeforeTemplate String before(String s) { @@ -64,6 +73,9 @@ String after(String s) { } } + @RecipeDescriptor( + name = "Replace `StringUtils.defaultString(Object, String)` with JDK internals", + description = "Replace Maven Shared `StringUtils.defaultString(Object obj, String nullDefault)` with JDK internals.") public static class DefaultStringFallback { @BeforeTemplate String before(String s, String nullDefault) { @@ -76,6 +88,9 @@ String after(String s, String nullDefault) { } } + @RecipeDescriptor( + name = "Replace `StringUtils.deleteWhitespace(String)` with JDK internals", + description = "Replace Maven Shared `StringUtils.deleteWhitespace(String str)` with JDK internals.") public static class DeleteWhitespace { @BeforeTemplate String before(@Matches(RepeatableArgumentMatcher.class) String s) { @@ -88,6 +103,9 @@ String after(String s) { } } + @RecipeDescriptor( + name = "Replace `StringUtils.equalsIgnoreCase(String, String)` with JDK internals", + description = "Replace Maven Shared `StringUtils.equalsIgnoreCase(String str1, String str2)` with JDK internals.") public static class EqualsIgnoreCase { @BeforeTemplate boolean before(@Matches(RepeatableArgumentMatcher.class) String s, @@ -101,6 +119,9 @@ boolean after(String s, String other) { } } + @RecipeDescriptor( + name = "Replace `StringUtils.equals(String, String)` with JDK internals", + description = "Replace Maven Shared `StringUtils.equals(String str1, String str2)` with JDK internals.") public static class Equals { @BeforeTemplate boolean before(String s, String other) { @@ -113,6 +134,9 @@ boolean after(String s, String other) { } } + @RecipeDescriptor( + name = "Replace `StringUtils.lowerCase(String)` with JDK internals", + description = "Replace Maven Shared `StringUtils.lowerCase(String str)` with JDK internals.") public static class Lowercase { @BeforeTemplate String before(@Matches(RepeatableArgumentMatcher.class) String s) { @@ -125,6 +149,9 @@ String after(String s) { } } + @RecipeDescriptor( + name = "Replace `StringUtils.replace(String, String, String)` with JDK internals", + description = "Replace Maven Shared `StringUtils.replace(String text, String searchString, String replacement)` with JDK internals.") public static class Replace { @BeforeTemplate String before(@Matches(RepeatableArgumentMatcher.class) String s, @@ -139,6 +166,9 @@ String after(String s, String search, String replacement) { } } + @RecipeDescriptor( + name = "Replace `StringUtils.reverse(String)` with JDK internals", + description = "Replace Maven Shared `StringUtils.reverse(String str)` with JDK internals.") public static class Reverse { @BeforeTemplate String before(@Matches(RepeatableArgumentMatcher.class) String s) { @@ -151,6 +181,9 @@ String after(String s) { } } + @RecipeDescriptor( + name = "Replace `StringUtils.split(String)` with JDK internals", + description = "Replace Maven Shared `StringUtils.split(String str)` with JDK internals.") public static class Split { @BeforeTemplate String[] before(@Matches(RepeatableArgumentMatcher.class) String s) { @@ -163,6 +196,9 @@ String[] after(String s) { } } + @RecipeDescriptor( + name = "Replace `StringUtils.strip(String)` with JDK internals", + description = "Replace Maven Shared `StringUtils.strip(String str)` with JDK internals.") public static class Strip { @BeforeTemplate String before(@Matches(RepeatableArgumentMatcher.class) String s) { @@ -175,6 +211,9 @@ String after(String s) { } } + @RecipeDescriptor( + name = "Replace `StringUtils.trim(String)` with JDK internals", + description = "Replace Maven Shared `StringUtils.trim(String str)` with JDK internals.") public static class Trim { @BeforeTemplate String before(@Matches(RepeatableArgumentMatcher.class) String s) { @@ -187,6 +226,9 @@ String after(String s) { } } + @RecipeDescriptor( + name = "Replace `StringUtils.upperCase(String)` with JDK internals", + description = "Replace Maven Shared `StringUtils.upperCase(String str)` with JDK internals.") public static class Uppercase { @BeforeTemplate String before(@Matches(RepeatableArgumentMatcher.class) String s) { @@ -198,5 +240,4 @@ String after(String s) { return (s == null ? null : s.toUpperCase()); } } - } diff --git a/src/main/java/org/openrewrite/java/migrate/plexus/PlexusFileUtils.java b/src/main/java/org/openrewrite/java/migrate/plexus/PlexusFileUtils.java index c06e65c347..9ac0d75093 100644 --- a/src/main/java/org/openrewrite/java/migrate/plexus/PlexusFileUtils.java +++ b/src/main/java/org/openrewrite/java/migrate/plexus/PlexusFileUtils.java @@ -18,6 +18,7 @@ import com.google.errorprone.refaster.annotation.AfterTemplate; import com.google.errorprone.refaster.annotation.BeforeTemplate; import org.codehaus.plexus.util.FileUtils; +import org.openrewrite.java.template.RecipeDescriptor; import java.io.File; @@ -25,6 +26,9 @@ class PlexusFileUtils { // https://github.com/codehaus-plexus/plexus-utils/blob/master/src/main/java/org/codehaus/plexus/util/StringUtils.java + @RecipeDescriptor( + name = "Replace `FileUtils.deleteDirectory(File)` with JDK internals", + description = "Replace Plexus `FileUtils.deleteDirectory(File directory)` with JDK internals.") static class DeleteDirectoryFile { @BeforeTemplate void before(File dir) throws Exception { @@ -37,6 +41,9 @@ void after(File dir) throws Exception { } } + @RecipeDescriptor( + name = "Replace `FileUtils.deleteDirectory(String)` with JDK internals", + description = "Replace Plexus `FileUtils.deleteDirectory(String directory)` with JDK internals.") static class DeleteDirectoryString { @BeforeTemplate void before(String dir) throws Exception { @@ -49,6 +56,9 @@ void after(String dir) throws Exception { } } + @RecipeDescriptor( + name = "Replace `FileUtils.fileExists(String)` with JDK internals", + description = "Replace Plexus `FileUtils.fileExists(String fileName)` with JDK internals.") static class FileExistsString { @BeforeTemplate boolean before(String fileName) throws Exception { @@ -61,6 +71,9 @@ boolean after(String fileName) throws Exception { } } + @RecipeDescriptor( + name = "Replace `FileUtils.getFile(String)` with JDK internals", + description = "Replace Plexus `FileUtils.getFile(String fileName)` with JDK internals.") static class GetFile { @BeforeTemplate File before(String fileName) throws Exception { @@ -72,5 +85,4 @@ File after(String fileName) throws Exception { return new File(fileName); } } - } diff --git a/src/main/java/org/openrewrite/java/migrate/plexus/PlexusStringUtils.java b/src/main/java/org/openrewrite/java/migrate/plexus/PlexusStringUtils.java index 9e35146a0e..5aed06e508 100644 --- a/src/main/java/org/openrewrite/java/migrate/plexus/PlexusStringUtils.java +++ b/src/main/java/org/openrewrite/java/migrate/plexus/PlexusStringUtils.java @@ -20,12 +20,15 @@ import org.codehaus.plexus.util.StringUtils; import org.openrewrite.java.migrate.apache.commons.lang.RepeatableArgumentMatcher; import org.openrewrite.java.template.Matches; +import org.openrewrite.java.template.RecipeDescriptor; import java.util.Objects; @SuppressWarnings("ALL") public class PlexusStringUtils { - + @RecipeDescriptor( + name = "Replace `StringUtils.abbreviate(String, int)` with JDK internals", + description = "Replace Plexus `StringUtils.abbreviate(String str, int maxWidth)` with JDK internals.") public static class Abbreviate { @BeforeTemplate String before(@Matches(RepeatableArgumentMatcher.class) String s1, @@ -39,8 +42,11 @@ String after(String s, int width) { } } + @RecipeDescriptor( + name = "Replace `StringUtils.capitalise(String)` with JDK internals", + description = "Replace Plexus `StringUtils.capitalise(String str)` with JDK internals.") @SuppressWarnings("ConstantValue") - public static class Capitalize { + public static class Capitalise { @BeforeTemplate String before(@Matches(RepeatableArgumentMatcher.class) String s) { return StringUtils.capitalise(s); @@ -52,6 +58,9 @@ String after(String s) { } } + @RecipeDescriptor( + name = "Replace `StringUtils.defaultString(Object)` with JDK internals", + description = "Replace Plexus `StringUtils.defaultString(Object obj)` with JDK internals.") public static class DefaultString { @BeforeTemplate String before(String s) { @@ -64,6 +73,9 @@ String after(String s) { } } + @RecipeDescriptor( + name = "Replace `StringUtils.defaultString(Object, String)` with JDK internals", + description = "Replace Plexus `StringUtils.defaultString(Object obj, String nullDefault)` with JDK internals.") public static class DefaultStringFallback { @BeforeTemplate String before(String s, String nullDefault) { @@ -76,6 +88,9 @@ String after(String s, String nullDefault) { } } + @RecipeDescriptor( + name = "Replace `StringUtils.deleteWhitespace(String)` with JDK internals", + description = "Replace Plexus `StringUtils.deleteWhitespace(String str)` with JDK internals.") public static class DeleteWhitespace { @BeforeTemplate String before(@Matches(RepeatableArgumentMatcher.class) String s) { @@ -88,6 +103,9 @@ String after(String s) { } } + @RecipeDescriptor( + name = "Replace `StringUtils.equalsIgnoreCase(String, String)` with JDK internals", + description = "Replace Plexus `StringUtils.equalsIgnoreCase(String str1, String str2)` with JDK internals.") public static class EqualsIgnoreCase { @BeforeTemplate boolean before(@Matches(RepeatableArgumentMatcher.class) String s, @@ -101,6 +119,9 @@ boolean after(String s, String other) { } } + @RecipeDescriptor( + name = "Replace `StringUtils.equals(String, String)` with JDK internals", + description = "Replace Plexus `StringUtils.equals(String str1, String str2)` with JDK internals.") public static class Equals { @BeforeTemplate boolean before(String s, String other) { @@ -113,6 +134,9 @@ boolean after(String s, String other) { } } + @RecipeDescriptor( + name = "Replace `StringUtils.lowerCase(String)` with JDK internals", + description = "Replace Plexus `StringUtils.lowerCase(String str)` with JDK internals.") public static class Lowercase { @BeforeTemplate String before(@Matches(RepeatableArgumentMatcher.class) String s) { @@ -125,6 +149,9 @@ String after(String s) { } } + @RecipeDescriptor( + name = "Replace `StringUtils.replace(String, String, String)` with JDK internals", + description = "Replace Plexus `StringUtils.replace(String text, String searchString, String replacement)` with JDK internals.") public static class Replace { @BeforeTemplate String before(@Matches(RepeatableArgumentMatcher.class) String s, @@ -139,6 +166,9 @@ String after(String s, String search, String replacement) { } } + @RecipeDescriptor( + name = "Replace `StringUtils.reverse(String)` with JDK internals", + description = "Replace Plexus `StringUtils.reverse(String str)` with JDK internals.") public static class Reverse { @BeforeTemplate String before(@Matches(RepeatableArgumentMatcher.class) String s) { @@ -151,6 +181,9 @@ String after(String s) { } } + @RecipeDescriptor( + name = "Replace `StringUtils.split(String)` with JDK internals", + description = "Replace Plexus `StringUtils.split(String str)` with JDK internals.") public static class Split { @BeforeTemplate String[] before(@Matches(RepeatableArgumentMatcher.class) String s) { @@ -163,6 +196,9 @@ String[] after(String s) { } } + @RecipeDescriptor( + name = "Replace `StringUtils.strip(String)` with JDK internals", + description = "Replace Plexus `StringUtils.strip(String str)` with JDK internals.") public static class Strip { @BeforeTemplate String before(@Matches(RepeatableArgumentMatcher.class) String s) { @@ -175,6 +211,9 @@ String after(String s) { } } + @RecipeDescriptor( + name = "Replace `StringUtils.trim(String)` with JDK internals", + description = "Replace Plexus `StringUtils.trim(String str)` with JDK internals.") public static class Trim { @BeforeTemplate String before(@Matches(RepeatableArgumentMatcher.class) String s) { @@ -187,6 +226,9 @@ String after(String s) { } } + @RecipeDescriptor( + name = "Replace `StringUtils.upperCase(String)` with JDK internals", + description = "Replace Plexus `StringUtils.upperCase(String str)` with JDK internals.") public static class Uppercase { @BeforeTemplate String before(@Matches(RepeatableArgumentMatcher.class) String s) {