diff --git a/src/main/java/org/openrewrite/maven/AbstractRewriteMojo.java b/src/main/java/org/openrewrite/maven/AbstractRewriteMojo.java index 094694ea..0dbe7c27 100644 --- a/src/main/java/org/openrewrite/maven/AbstractRewriteMojo.java +++ b/src/main/java/org/openrewrite/maven/AbstractRewriteMojo.java @@ -339,6 +339,10 @@ protected ResultsContainer listResults() throws MojoExecutionException { } private void discoverRecipeTypes(Recipe recipe, Set> recipeTypes) { + for (Recipe next : recipe.getRecipeList()) { + discoverRecipeTypes(next, recipeTypes); + } + try { Method getVisitor = recipe.getClass().getDeclaredMethod("getVisitor"); getVisitor.setAccessible(true); @@ -354,9 +358,6 @@ private void discoverRecipeTypes(Recipe recipe, Set> recipeTypes) { } else if (visitor instanceof YamlVisitor) { recipeTypes.add(YamlVisitor.class); } - for (Recipe next : recipe.getRecipeList()) { - discoverRecipeTypes(next, recipeTypes); - } } catch (NoSuchMethodException | InvocationTargetException | IllegalAccessException ignored) { // not every recipe will implement getVisitor() directly, e.g. CompositeRecipe. }