From 4b944ba3c39491e295cf74475cd10f895034223b Mon Sep 17 00:00:00 2001 From: Knut Wannheden Date: Sat, 30 Dec 2023 00:11:37 +0100 Subject: [PATCH] Allow `JavaTemplate` to deal with expressions that are also statements (#3867) For Groovy support the `J.Ternary` was extended to also implement the `Statement` interface. As a consequence its coordinate is now a `CoordinateBuilder.Statement` coordinate. Allow `JavaTemplate` to replace it in its `visitExpression()` method in `JavaTemplateJavaExtension`. Issue: openrewrite/rewrite-static-analysis#203 --- .../java/internal/template/JavaTemplateJavaExtension.java | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/rewrite-java/src/main/java/org/openrewrite/java/internal/template/JavaTemplateJavaExtension.java b/rewrite-java/src/main/java/org/openrewrite/java/internal/template/JavaTemplateJavaExtension.java index 0c21837a62a..5ae3e88544d 100644 --- a/rewrite-java/src/main/java/org/openrewrite/java/internal/template/JavaTemplateJavaExtension.java +++ b/rewrite-java/src/main/java/org/openrewrite/java/internal/template/JavaTemplateJavaExtension.java @@ -221,7 +221,9 @@ public JavaType.Variable visitVariable(JavaType.Variable variable, List