File tree Expand file tree Collapse file tree
src/main/java/org/openrewrite/java/migrate/lang Expand file tree Collapse file tree Original file line number Diff line number Diff line change 2828import org .openrewrite .java .tree .J ;
2929import org .openrewrite .java .tree .Statement ;
3030import org .openrewrite .staticanalysis .VariableReferences ;
31+ import org .openrewrite .staticanalysis .groovy .GroovyFileChecker ;
32+ import org .openrewrite .staticanalysis .kotlin .KotlinFileChecker ;
3133
3234import java .util .concurrent .atomic .AtomicBoolean ;
3335
@@ -45,7 +47,12 @@ public class ReplaceUnusedVariablesWithUnderscore extends Recipe {
4547
4648 @ Override
4749 public TreeVisitor <?, ExecutionContext > getVisitor () {
48- return Preconditions .check (new UsesJavaVersion <>(22 ), new JavaIsoVisitor <ExecutionContext >() {
50+ TreeVisitor <?, ExecutionContext > preconditions = Preconditions .and (
51+ new UsesJavaVersion <>(22 ),
52+ Preconditions .not (new KotlinFileChecker <>()),
53+ Preconditions .not (new GroovyFileChecker <>())
54+ );
55+ return Preconditions .check (preconditions , new JavaIsoVisitor <ExecutionContext >() {
4956 @ Override
5057 public J .ForEachLoop visitForEachLoop (J .ForEachLoop forLoop , ExecutionContext ctx ) {
5158 J .ForEachLoop l = super .visitForEachLoop (forLoop , ctx );
You can’t perform that action at this time.
0 commit comments