Skip to content

Commit

Permalink
Drop unnecessary UsesType
Browse files Browse the repository at this point in the history
  • Loading branch information
timtebeek committed Oct 27, 2024
1 parent fc838e8 commit 610c1c3
Showing 1 changed file with 2 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@
import org.openrewrite.java.JavaTemplate;
import org.openrewrite.java.JavaVisitor;
import org.openrewrite.java.search.UsesMethod;
import org.openrewrite.java.search.UsesType;
import org.openrewrite.java.template.Semantics;
import org.openrewrite.java.template.internal.AbstractRefasterJavaVisitor;
import org.openrewrite.java.tree.J;
Expand All @@ -37,7 +36,7 @@ public class BufferedWriterCreation extends Recipe {

@Override
public String getDisplayName() {
return "Modernize BufferedWriter creation & prevent file descriptor leak";
return "Modernize `BufferedWriter` creation & prevent file descriptor leak";
}

@Override
Expand Down Expand Up @@ -148,12 +147,10 @@ public J visitNewClass(J.NewClass elem, ExecutionContext ctx) {
}
return null;
}

};

return Preconditions.check(
Preconditions.and(
new UsesType<>("java.io.BufferedWriter", true),
new UsesType<>("java.io.FileWriter", true),
new UsesMethod<>("java.io.BufferedWriter <constructor>(..)"),
new UsesMethod<>("java.io.FileWriter <constructor>(..)")
),
Expand Down

0 comments on commit 610c1c3

Please sign in to comment.