Skip to content

Commit

Permalink
Allow composition of DependencyInsight in rewrite-java-dependencies
Browse files Browse the repository at this point in the history
  • Loading branch information
timtebeek committed Aug 21, 2024
1 parent c836be0 commit 1dfe938
Showing 1 changed file with 5 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,6 @@

import static java.util.Objects.requireNonNull;


@Value
@EqualsAndHashCode(callSuper = false)
public class DependencyInsight extends Recipe {
Expand Down Expand Up @@ -102,6 +101,11 @@ public Validated<Object> validate() {
@Override
public TreeVisitor<?, ExecutionContext> getVisitor() {
return new TreeVisitor<Tree, ExecutionContext>() {
@Override
public boolean isAcceptable(SourceFile sourceFile, ExecutionContext ctx) {
return sourceFile.getMarkers().findFirst(GradleProject.class).isPresent();
}

@Override
public Tree visit(@Nullable Tree tree, ExecutionContext ctx) {
SourceFile sourceFile = (SourceFile) requireNonNull(tree);
Expand Down

0 comments on commit 1dfe938

Please sign in to comment.