Skip to content

Commit

Permalink
Use either the Gradle DependencyInsight visitor or the Maven
Browse files Browse the repository at this point in the history
Not both; following this fix to the Gradle DependencyInsight visitor:
openrewrite/rewrite@1dfe938
  • Loading branch information
timtebeek committed Aug 21, 2024
1 parent 102b76a commit ee35c10
Showing 1 changed file with 5 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -60,20 +60,20 @@ public String getDescription() {
@Override
public TreeVisitor<?, ExecutionContext> getVisitor() {
return new TreeVisitor<Tree, ExecutionContext>() {
final TreeVisitor<?, ExecutionContext> gdi = new org.openrewrite.gradle.search.DependencyInsight(groupIdPattern, artifactIdPattern, version,null)
final TreeVisitor<?, ExecutionContext> gdi = new org.openrewrite.gradle.search.DependencyInsight(groupIdPattern, artifactIdPattern, version, null)
.getVisitor();
final TreeVisitor<?, ExecutionContext> mdi = new org.openrewrite.maven.search.DependencyInsight(groupIdPattern, artifactIdPattern, null, version, false)
.getVisitor();

@Override
public @Nullable Tree visit(@Nullable Tree tree, ExecutionContext ctx) {
if(!(tree instanceof SourceFile)) {
if (!(tree instanceof SourceFile)) {
return tree;
}
SourceFile s = (SourceFile) tree;
if(gdi.isAcceptable(s, ctx)) {
if (gdi.isAcceptable(s, ctx)) {
s = (SourceFile) gdi.visitNonNull(s, ctx);
}
if(mdi.isAcceptable(s, ctx)) {
} else if (mdi.isAcceptable(s, ctx)) {
s = (SourceFile) mdi.visitNonNull(s, ctx);
}
return s;
Expand Down

0 comments on commit ee35c10

Please sign in to comment.