From 83b2f77b532c8b9b206f72360595cdc8746ff73f Mon Sep 17 00:00:00 2001 From: Knut Wannheden Date: Sun, 26 Nov 2023 20:23:33 +0100 Subject: [PATCH] Make another template context-free --- .../java/recipes/SetDefaultEstimatedEffortPerOccurrence.java | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/rewrite-java/src/main/java/org/openrewrite/java/recipes/SetDefaultEstimatedEffortPerOccurrence.java b/rewrite-java/src/main/java/org/openrewrite/java/recipes/SetDefaultEstimatedEffortPerOccurrence.java index 65db18f5190..8038ef4bc78 100644 --- a/rewrite-java/src/main/java/org/openrewrite/java/recipes/SetDefaultEstimatedEffortPerOccurrence.java +++ b/rewrite-java/src/main/java/org/openrewrite/java/recipes/SetDefaultEstimatedEffortPerOccurrence.java @@ -55,12 +55,11 @@ public TreeVisitor getVisitor() { "@Override public Duration getEstimatedEffortPerOccurrence() {\n" + "return Duration.ofMinutes(5);\n" + "}") - .contextSensitive() .imports("java.time.Duration") .build(); @Override - public J.ClassDeclaration visitClassDeclaration(J.ClassDeclaration classDecl, ExecutionContext executionContext) { + public J.ClassDeclaration visitClassDeclaration(J.ClassDeclaration classDecl, ExecutionContext ctx) { JavaType.FullyQualified type = TypeUtils.asFullyQualified(classDecl.getType()); if (TypeUtils.isAssignableTo("org.openrewrite.Recipe", type)) { assert type != null; @@ -87,7 +86,7 @@ public J.ClassDeclaration visitClassDeclaration(J.ClassDeclaration classDecl, Ex throw new RuntimeException(e); } } - return super.visitClassDeclaration(classDecl, executionContext); + return super.visitClassDeclaration(classDecl, ctx); } }); }