prefer JDK String replace methods to Plexus ones by elharo · Pull Request #193 · apache/maven-release (original) (raw)

@timtebeek

Appreciate the update @elharo ; do I understand that this is one you'd like to tackle next?
I had a quick look; there's some 190 occurrences of StringUtils.replace(..) left in Apache Maven;
45 of those are in src/test; most involve replacing some variant of slashes:
https://public.moderne.io/results/kTDTf/data-tables (temporary link) / Google Sheets (less temporary)

Since we can't yet detect nullability, we'd likely have to insert a null check and fallback, which might look slightly awkward in some. Potentially we'd be able to clean that up in the future, but that would be some time away. Let me know if this is something you'd want to proceed with.

Alternatively there's another few common methods that can be found through:
https://public.moderne.io/recipes/org.openrewrite.java.search.FindMethods
With method pattern *..StringUtils *(..) run against the Apache Maven organization (top right dropdown).
Or we can have a look at some of the FileUtils/IOUtils, although I suspect those would require Java 11+ for JDK replacements.