From 1dc233d835f6380f7f8b655f1003742cc4103091 Mon Sep 17 00:00:00 2001 From: Jonathan Schneider Date: Thu, 10 Feb 2022 07:26:09 -0800 Subject: [PATCH] UseMapOf applicable test --- .../java/org/openrewrite/java/migrate/lang/UseMapOf.java | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/main/java/org/openrewrite/java/migrate/lang/UseMapOf.java b/src/main/java/org/openrewrite/java/migrate/lang/UseMapOf.java index 6a4b64785f..6c62335a46 100644 --- a/src/main/java/org/openrewrite/java/migrate/lang/UseMapOf.java +++ b/src/main/java/org/openrewrite/java/migrate/lang/UseMapOf.java @@ -17,9 +17,11 @@ import org.openrewrite.ExecutionContext; import org.openrewrite.Recipe; +import org.openrewrite.TreeVisitor; import org.openrewrite.java.JavaTemplate; import org.openrewrite.java.JavaVisitor; import org.openrewrite.java.MethodMatcher; +import org.openrewrite.java.search.UsesMethod; import org.openrewrite.java.tree.Expression; import org.openrewrite.java.tree.J; import org.openrewrite.java.tree.Statement; @@ -42,6 +44,11 @@ public String getDescription() { return "This succinct syntax was introduced in Java 10."; } + @Override + protected TreeVisitor getSingleSourceApplicableTest() { + return new UsesMethod<>(NEW_HASH_MAP); + } + @Override protected JavaVisitor getVisitor() { return new JavaVisitor() {