Skip to content

Commit f9e370a

Browse files
refactor: OpenRewrite Recipe best practices
Use this link to re-run the recipe: https://app.moderne.io/recipes/org.openrewrite.recipes.rewrite.OpenRewriteRecipeBestPractices?organizationId=T3BlblJld3JpdGU%3D Co-authored-by: Moderne <team@moderne.io>
1 parent 16447b1 commit f9e370a

2 files changed

Lines changed: 3 additions & 3 deletions

File tree

src/main/java/org/openrewrite/java/dependencies/RemoveDependency.java

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -107,9 +107,8 @@ public TreeVisitor<?, ExecutionContext> getScanner(Map<JavaProject, Boolean> pro
107107
@Override
108108
public Tree preVisit(Tree tree, ExecutionContext ctx) {
109109
stopAfterPreVisit();
110-
tree.getMarkers().findFirst(JavaProject.class).ifPresent(javaProject -> {
111-
projectToInUse.compute(javaProject, (jp, foundSoFar) -> Boolean.TRUE.equals(foundSoFar) || tree != usesType.visit(tree, ctx));
112-
});
110+
tree.getMarkers().findFirst(JavaProject.class).ifPresent(javaProject ->
111+
projectToInUse.compute(javaProject, (jp, foundSoFar) -> Boolean.TRUE.equals(foundSoFar) || tree != usesType.visit(tree, ctx)));
113112
return tree;
114113
}
115114
};

src/main/java/org/openrewrite/java/dependencies/UpgradeDependencyVersion.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -124,6 +124,7 @@ public TreeVisitor<?, ExecutionContext> getVisitor(Accumulator acc) {
124124
TreeVisitor<?, ExecutionContext> gradleVisitor = getUpgradeGradleDependencyVersion().getVisitor(acc.gradleAccumulator);
125125
return new TreeVisitor<Tree, ExecutionContext>() {
126126

127+
@Override
127128
public boolean isAcceptable(SourceFile sourceFile, ExecutionContext ctx) {
128129
return mavenVisitor.isAcceptable(sourceFile, ctx) || gradleVisitor.isAcceptable(sourceFile, ctx);
129130
}

0 commit comments

Comments
 (0)