Skip to content

Commit 4aab4b3

Browse files
committed
Remove some now obsolete code
1 parent eea2f46 commit 4aab4b3

File tree

3 files changed

+3
-26
lines changed

3 files changed

+3
-26
lines changed

rewrite-gradle/src/main/java/org/openrewrite/gradle/AddDependencyVisitor.java

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -73,9 +73,6 @@ public class AddDependencyVisitor extends JavaIsoVisitor<ExecutionContext> {
7373
public @Nullable J visit(@Nullable Tree tree, ExecutionContext ctx) {
7474
if (tree instanceof JavaSourceFile) {
7575
JavaSourceFile sourceFile = (JavaSourceFile) tree;
76-
if (sourceFile == null) {
77-
return null;
78-
}
7976
gradleProject = sourceFile.getMarkers().findFirst(GradleProject.class).orElse(null);
8077
if (gradleProject == null) {
8178
return sourceFile;
@@ -99,12 +96,6 @@ public class AddDependencyVisitor extends JavaIsoVisitor<ExecutionContext> {
9996
}
10097
}
10198
}
102-
}
103-
104-
J j = super.visit(tree, ctx);
105-
106-
if (j instanceof JavaSourceFile) {
107-
JavaSourceFile sourceFile = (JavaSourceFile) j;
10899

109100
sourceFile = (JavaSourceFile) new org.openrewrite.gradle.internal.AddDependencyVisitor(configuration, groupId, artifactId, resolvedVersion, classifier, extension, insertPredicate, dependencyModifier, isKotlinDsl)
110101
.visitNonNull(sourceFile, ctx);
@@ -121,7 +112,7 @@ public class AddDependencyVisitor extends JavaIsoVisitor<ExecutionContext> {
121112

122113
return sourceFile;
123114
}
124-
return j;
115+
return (J) tree;
125116
}
126117

127118
public enum DependencyModifier {

rewrite-gradle/src/main/java/org/openrewrite/gradle/search/FindJVMTestSuites.java

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -38,11 +38,6 @@ public class FindJVMTestSuites extends Recipe {
3838

3939
transient JVMTestSuitesDefined jvmTestSuitesDefined = new JVMTestSuitesDefined(this);
4040

41-
@Option(displayName = "Requires dependencies",
42-
description = "Whether the test suite configuration defines dependencies to be resolved. Defaults to false.")
43-
@Nullable
44-
Boolean definesDependencies;
45-
4641
@Option(displayName = "Insert rows",
4742
description = "Whether to insert rows into the table. Defaults to true.")
4843
@Nullable
@@ -60,7 +55,6 @@ public String getDescription() {
6055

6156
@Override
6257
public TreeVisitor<?, ExecutionContext> getVisitor() {
63-
boolean requireDependencies = definesDependencies != null && definesDependencies;
6458
boolean tableAvailable = this.insertRows == null || this.insertRows;
6559
return Preconditions.check(new IsBuildGradle<>(), jvmTestSuite().asVisitor((suite, ctx) -> {
6660
if (tableAvailable) {
@@ -70,8 +64,8 @@ public TreeVisitor<?, ExecutionContext> getVisitor() {
7064
}));
7165
}
7266

73-
public static Set<String> jvmTestSuiteNames(Tree tree, boolean definesDependencies) {
74-
return TreeVisitor.collect(new FindJVMTestSuites(definesDependencies, false).getVisitor(), tree, new HashSet<>())
67+
public static Set<String> jvmTestSuiteNames(Tree tree) {
68+
return TreeVisitor.collect(new FindJVMTestSuites(false).getVisitor(), tree, new HashSet<>())
7569
.stream()
7670
.filter(J.MethodInvocation.class::isInstance)
7771
.map(J.MethodInvocation.class::cast)

rewrite-gradle/src/test/java/org/openrewrite/gradle/search/FindJVMTestSuitesTest.java

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -54,14 +54,6 @@ void configFalse() {
5454
)
5555
);
5656
}
57-
58-
@Test
59-
void configTrue() {
60-
rewriteRun(
61-
spec -> spec.recipe(new FindJVMTestSuites(true, null)),
62-
buildGradle(withoutDependency)
63-
);
64-
}
6557
}
6658

6759
@Nested

0 commit comments

Comments
 (0)