diff --git a/src/main/java/org/openrewrite/java/migrate/lang/var/UseVarForObject.java b/src/main/java/org/openrewrite/java/migrate/lang/var/UseVarForObject.java index a223b378a7..78456da21d 100644 --- a/src/main/java/org/openrewrite/java/migrate/lang/var/UseVarForObject.java +++ b/src/main/java/org/openrewrite/java/migrate/lang/var/UseVarForObject.java @@ -60,6 +60,7 @@ public TreeVisitor getVisitor() { static final class UseVarForObjectVisitor extends JavaIsoVisitor { private final JavaTemplate template = JavaTemplate.builder("var #{} = #{any()}") + .contextSensitive() .javaParser(JavaParser.fromJavaVersion()).build();