From 45e00d732dfb65661552cabde5d31e7546c7bbd9 Mon Sep 17 00:00:00 2001 From: Rick Ossendrijver Date: Wed, 21 Feb 2024 11:40:19 +0100 Subject: [PATCH] refactor: Refaster rules related to expressions dealing with `String`s (#4029) Use this link to re-run the recipe: https://app.moderne.io/recipes/tech.picnic.errorprone.refasterrules.StringRulesRecipes?organizationId=T3BlblJld3JpdGU%3D Co-authored-by: Moderne --- rewrite-core/src/main/java/org/eclipse/jgit/util/FS.java | 2 +- .../main/java/org/openrewrite/java/recipes/FindRecipes.java | 3 +-- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/rewrite-core/src/main/java/org/eclipse/jgit/util/FS.java b/rewrite-core/src/main/java/org/eclipse/jgit/util/FS.java index 16936d0838a..be301b51f46 100644 --- a/rewrite-core/src/main/java/org/eclipse/jgit/util/FS.java +++ b/rewrite-core/src/main/java/org/eclipse/jgit/util/FS.java @@ -1417,7 +1417,7 @@ private static class GobblerThread extends Thread { GobblerThread(Process p, String[] command, File dir) { this.p = p; this.desc = Arrays.toString(command); - this.dir = Objects.toString(dir); + this.dir = String.valueOf(dir); } @Override diff --git a/rewrite-java/src/main/java/org/openrewrite/java/recipes/FindRecipes.java b/rewrite-java/src/main/java/org/openrewrite/java/recipes/FindRecipes.java index abe0fe8cc68..e524be095d0 100644 --- a/rewrite-java/src/main/java/org/openrewrite/java/recipes/FindRecipes.java +++ b/rewrite-java/src/main/java/org/openrewrite/java/recipes/FindRecipes.java @@ -36,7 +36,6 @@ import java.util.ArrayList; import java.util.List; -import java.util.Objects; import static java.util.Objects.requireNonNull; @@ -153,7 +152,7 @@ private ValueNode mapValue(@Nullable Object value) { } else if (value == null) { return JsonNodeFactory.instance.nullNode(); } - throw new IllegalArgumentException(Objects.toString(value)); + throw new IllegalArgumentException(String.valueOf(value)); } }); }