diff --git a/rewrite-core/src/main/java/org/openrewrite/RecipeScheduler.java b/rewrite-core/src/main/java/org/openrewrite/RecipeScheduler.java index 98c1a8513c9..4b272f878fd 100644 --- a/rewrite-core/src/main/java/org/openrewrite/RecipeScheduler.java +++ b/rewrite-core/src/main/java/org/openrewrite/RecipeScheduler.java @@ -159,13 +159,17 @@ default List scheduleVisit(RecipeRunStats runStats, ((WatchableExecutionContext) ctx).resetHasNewMessages(); } try { - for (S s : before) { - for (Recipe r : recipeStack) { - for (TreeVisitor applicableTest : r.getApplicableTests()) { - if (applicableTest.visit(s, ctx) == s) { - return before; + for (Recipe r : recipeStack) { + nextTest: + for (TreeVisitor applicableTest : r.getApplicableTests()) { + for (S s : before) { + if (applicableTest.visit(s, ctx) != s) { + continue nextTest; } } + if (!before.isEmpty()) { + return before; + } } } } catch (Throwable t) {