From 67ac75ba21d545848d33ff1b97443324a8cccebf Mon Sep 17 00:00:00 2001 From: Tim te Beek Date: Mon, 18 Dec 2023 10:37:55 +0100 Subject: [PATCH 1/2] Add generated annotations to stop scanning tools For https://github.com/PicnicSupermarket/error-prone-support/pull/925 & @Stephan202 --- .../java/template/processor/RefasterTemplateProcessor.java | 7 ++++++- .../java/template/processor/TemplateProcessor.java | 1 + src/test/resources/refaster/EscapesRecipes.java | 3 +++ src/test/resources/refaster/MatchingRecipes.java | 3 ++- src/test/resources/refaster/MethodThrowsRecipe.java | 1 + .../resources/refaster/MultipleDereferencesRecipes.java | 4 ++++ src/test/resources/refaster/NestedPreconditionsRecipe.java | 1 + src/test/resources/refaster/ParameterReuseRecipe.java | 2 +- src/test/resources/refaster/ShouldAddImportsRecipes.java | 4 ++++ .../refaster/ShouldSupportNestedClassesRecipes.java | 4 +++- src/test/resources/refaster/SimplifyBooleansRecipe.java | 2 +- src/test/resources/refaster/UseStringIsEmptyRecipe.java | 1 + .../resources/template/ParameterReuseRecipe$1_before.java | 1 + ...uldAddClasspathRecipe$FullyQualifiedRecipe$1_after.java | 1 + ...ldAddClasspathRecipe$FullyQualifiedRecipe$1_before.java | 1 + .../ShouldAddClasspathRecipe$PrimitiveRecipe$1_after.java | 1 + .../ShouldAddClasspathRecipe$PrimitiveRecipe$1_before.java | 1 + ...ShouldAddClasspathRecipe$UnqualifiedRecipe$1_after.java | 1 + ...houldAddClasspathRecipe$UnqualifiedRecipe$1_before.java | 1 + 19 files changed, 35 insertions(+), 5 deletions(-) diff --git a/src/main/java/org/openrewrite/java/template/processor/RefasterTemplateProcessor.java b/src/main/java/org/openrewrite/java/template/processor/RefasterTemplateProcessor.java index f12d4362..2feab8ee 100644 --- a/src/main/java/org/openrewrite/java/template/processor/RefasterTemplateProcessor.java +++ b/src/main/java/org/openrewrite/java/template/processor/RefasterTemplateProcessor.java @@ -154,7 +154,10 @@ public void visitClassDef(JCTree.JCClassDecl classDecl) { } for (Set imports : imports.values()) { - imports.removeIf(i -> "java.lang".equals(i.substring(0, i.lastIndexOf('.')))); + imports.removeIf(i -> { + int endIndex = i.lastIndexOf('.'); + return endIndex < 0 || "java.lang".equals(i.substring(0, endIndex)); + }); imports.remove(BEFORE_TEMPLATE); imports.remove(AFTER_TEMPLATE); } @@ -179,6 +182,7 @@ public void visitClassDef(JCTree.JCClassDecl classDecl) { String refasterRuleClassName = classDecl.sym.fullname.toString().substring(classDecl.sym.packge().fullname.length() + 1); recipe.append("/**\n * OpenRewrite recipe created for Refaster template {@code ").append(refasterRuleClassName).append("}.\n */\n"); String recipeName = templateFqn.substring(templateFqn.lastIndexOf('.') + 1); + recipe.append("@javax.annotation.Generated(\"org.openrewrite.java.template.processor.RefasterTemplateProcessor\")\n"); recipe.append("@NonNullApi\n"); recipe.append(descriptor.classDecl.sym.outermostClass() == descriptor.classDecl.sym ? "public class " : "public static class ").append(recipeName).append(" extends Recipe {\n\n"); @@ -340,6 +344,7 @@ public void visitClassDef(JCTree.JCClassDecl classDecl) { if (outerClassRequired) { out.write("/**\n * OpenRewrite recipes created for Refaster template {@code " + inputOuterFQN + "}.\n */\n"); String outerClassName = className.substring(className.lastIndexOf('.') + 1); + out.write("@javax.annotation.Generated(\"org.openrewrite.java.template.processor.RefasterTemplateProcessor\")\n"); out.write("public class " + outerClassName + " extends Recipe {\n"); out.write(" /**\n"); out.write(" * Instantiates a new instance.\n"); diff --git a/src/main/java/org/openrewrite/java/template/processor/TemplateProcessor.java b/src/main/java/org/openrewrite/java/template/processor/TemplateProcessor.java index 94266003..77d7635a 100644 --- a/src/main/java/org/openrewrite/java/template/processor/TemplateProcessor.java +++ b/src/main/java/org/openrewrite/java/template/processor/TemplateProcessor.java @@ -217,6 +217,7 @@ public void visitIdent(JCTree.JCIdent ident) { out.write("\n"); out.write("/**\n * OpenRewrite `" + templateName.getValue() + "` template created for {@code " + templateFqn.split("_")[0] + "}.\n */\n"); String templateClassName = templateFqn.substring(templateFqn.lastIndexOf('.') + 1); + out.write("@javax.annotation.Generated(\"org.openrewrite.java.template.processor.TemplateProcessor\")\n"); out.write("public class " + templateClassName + " {\n"); out.write(" /**\n"); out.write(" * Instantiates a new instance.\n"); diff --git a/src/test/resources/refaster/EscapesRecipes.java b/src/test/resources/refaster/EscapesRecipes.java index 285ace88..8e127541 100644 --- a/src/test/resources/refaster/EscapesRecipes.java +++ b/src/test/resources/refaster/EscapesRecipes.java @@ -36,6 +36,7 @@ import com.sun.tools.javac.util.Convert; import com.sun.tools.javac.util.Constants; +@javax.annotation.Generated("org.openrewrite.java.template.processor.RefasterTemplateProcessor") public class EscapesRecipes extends Recipe { public EscapesRecipes() {} @@ -57,6 +58,7 @@ public List getRecipeList() { ); } + @javax.annotation.Generated("org.openrewrite.java.template.processor.RefasterTemplateProcessor") @NonNullApi public static class ConstantsFormatRecipe extends Recipe { public ConstantsFormatRecipe() {} @@ -104,6 +106,7 @@ public J visitMethodInvocation(J.MethodInvocation elem, ExecutionContext ctx) { } } + @javax.annotation.Generated("org.openrewrite.java.template.processor.RefasterTemplateProcessor") @NonNullApi public static class SplitRecipe extends Recipe { public SplitRecipe() {} diff --git a/src/test/resources/refaster/MatchingRecipes.java b/src/test/resources/refaster/MatchingRecipes.java index d56d067c..40bef7e6 100644 --- a/src/test/resources/refaster/MatchingRecipes.java +++ b/src/test/resources/refaster/MatchingRecipes.java @@ -33,7 +33,7 @@ import static org.openrewrite.java.template.internal.AbstractRefasterJavaVisitor.EmbeddingOption.*; - +@javax.annotation.Generated("org.openrewrite.java.template.processor.RefasterTemplateProcessor") public class MatchingRecipes extends Recipe { public MatchingRecipes() {} @@ -60,6 +60,7 @@ public List getRecipeList() { ); } + @javax.annotation.Generated("org.openrewrite.java.template.processor.RefasterTemplateProcessor") @NonNullApi public static class StringIsEmptyRecipe extends Recipe { diff --git a/src/test/resources/refaster/MethodThrowsRecipe.java b/src/test/resources/refaster/MethodThrowsRecipe.java index 868b14f9..6fea4c5f 100644 --- a/src/test/resources/refaster/MethodThrowsRecipe.java +++ b/src/test/resources/refaster/MethodThrowsRecipe.java @@ -37,6 +37,7 @@ import java.nio.file.Path; import java.nio.charset.StandardCharsets; +@javax.annotation.Generated("org.openrewrite.java.template.processor.RefasterTemplateProcessor") @NonNullApi public class MethodThrowsRecipe extends Recipe { diff --git a/src/test/resources/refaster/MultipleDereferencesRecipes.java b/src/test/resources/refaster/MultipleDereferencesRecipes.java index ea75d504..447f92ac 100644 --- a/src/test/resources/refaster/MultipleDereferencesRecipes.java +++ b/src/test/resources/refaster/MultipleDereferencesRecipes.java @@ -36,6 +36,7 @@ import java.nio.file.Files; import java.nio.file.Path; +@javax.annotation.Generated("org.openrewrite.java.template.processor.RefasterTemplateProcessor") public class MultipleDereferencesRecipes extends Recipe { public MultipleDereferencesRecipes() {} @@ -59,6 +60,7 @@ public List getRecipeList() { ); } + @javax.annotation.Generated("org.openrewrite.java.template.processor.RefasterTemplateProcessor") @NonNullApi public static class VoidTypeRecipe extends Recipe { @@ -106,6 +108,7 @@ public J visitMethodInvocation(J.MethodInvocation elem, ExecutionContext ctx) { } } + @javax.annotation.Generated("org.openrewrite.java.template.processor.RefasterTemplateProcessor") @NonNullApi public static class StringIsEmptyRecipe extends Recipe { @@ -149,6 +152,7 @@ public J visitMethodInvocation(J.MethodInvocation elem, ExecutionContext ctx) { } } + @javax.annotation.Generated("org.openrewrite.java.template.processor.RefasterTemplateProcessor") @NonNullApi public static class EqualsItselfRecipe extends Recipe { diff --git a/src/test/resources/refaster/NestedPreconditionsRecipe.java b/src/test/resources/refaster/NestedPreconditionsRecipe.java index 81caad63..5a26fbc7 100644 --- a/src/test/resources/refaster/NestedPreconditionsRecipe.java +++ b/src/test/resources/refaster/NestedPreconditionsRecipe.java @@ -38,6 +38,7 @@ import java.util.HashMap; import java.util.Hashtable; +@javax.annotation.Generated("org.openrewrite.java.template.processor.RefasterTemplateProcessor") @NonNullApi public class NestedPreconditionsRecipe extends Recipe { diff --git a/src/test/resources/refaster/ParameterReuseRecipe.java b/src/test/resources/refaster/ParameterReuseRecipe.java index b58f548d..6c817169 100644 --- a/src/test/resources/refaster/ParameterReuseRecipe.java +++ b/src/test/resources/refaster/ParameterReuseRecipe.java @@ -33,7 +33,7 @@ import static org.openrewrite.java.template.internal.AbstractRefasterJavaVisitor.EmbeddingOption.*; - +@javax.annotation.Generated("org.openrewrite.java.template.processor.RefasterTemplateProcessor") @NonNullApi public class ParameterReuseRecipe extends Recipe { diff --git a/src/test/resources/refaster/ShouldAddImportsRecipes.java b/src/test/resources/refaster/ShouldAddImportsRecipes.java index cbaf999c..70711b58 100644 --- a/src/test/resources/refaster/ShouldAddImportsRecipes.java +++ b/src/test/resources/refaster/ShouldAddImportsRecipes.java @@ -37,6 +37,7 @@ import static java.util.Objects.hash; +@javax.annotation.Generated("org.openrewrite.java.template.processor.RefasterTemplateProcessor") public class ShouldAddImportsRecipes extends Recipe { public ShouldAddImportsRecipes() {} @@ -60,6 +61,7 @@ public List getRecipeList() { ); } + @javax.annotation.Generated("org.openrewrite.java.template.processor.RefasterTemplateProcessor") @NonNullApi public static class StringValueOfRecipe extends Recipe { @@ -103,6 +105,7 @@ public J visitMethodInvocation(J.MethodInvocation elem, ExecutionContext ctx) { } } + @javax.annotation.Generated("org.openrewrite.java.template.processor.RefasterTemplateProcessor") @NonNullApi public static class ObjectsEqualsRecipe extends Recipe { @@ -162,6 +165,7 @@ public J visitMethodInvocation(J.MethodInvocation elem, ExecutionContext ctx) { } } + @javax.annotation.Generated("org.openrewrite.java.template.processor.RefasterTemplateProcessor") @NonNullApi public static class StaticImportObjectsHashRecipe extends Recipe { diff --git a/src/test/resources/refaster/ShouldSupportNestedClassesRecipes.java b/src/test/resources/refaster/ShouldSupportNestedClassesRecipes.java index 1492545f..c7eab94f 100644 --- a/src/test/resources/refaster/ShouldSupportNestedClassesRecipes.java +++ b/src/test/resources/refaster/ShouldSupportNestedClassesRecipes.java @@ -33,7 +33,7 @@ import static org.openrewrite.java.template.internal.AbstractRefasterJavaVisitor.EmbeddingOption.*; - +@javax.annotation.Generated("org.openrewrite.java.template.processor.RefasterTemplateProcessor") public class ShouldSupportNestedClassesRecipes extends Recipe { public ShouldSupportNestedClassesRecipes() {} @@ -56,6 +56,7 @@ public List getRecipeList() { ); } + @javax.annotation.Generated("org.openrewrite.java.template.processor.RefasterTemplateProcessor") @NonNullApi public static class NestedClassRecipe extends Recipe { @@ -99,6 +100,7 @@ public J visitBinary(J.Binary elem, ExecutionContext ctx) { } } + @javax.annotation.Generated("org.openrewrite.java.template.processor.RefasterTemplateProcessor") @NonNullApi public static class AnotherClassRecipe extends Recipe { diff --git a/src/test/resources/refaster/SimplifyBooleansRecipe.java b/src/test/resources/refaster/SimplifyBooleansRecipe.java index 10d1b105..d1fbfce2 100644 --- a/src/test/resources/refaster/SimplifyBooleansRecipe.java +++ b/src/test/resources/refaster/SimplifyBooleansRecipe.java @@ -33,7 +33,7 @@ import static org.openrewrite.java.template.internal.AbstractRefasterJavaVisitor.EmbeddingOption.*; - +@javax.annotation.Generated("org.openrewrite.java.template.processor.RefasterTemplateProcessor") @NonNullApi public class SimplifyBooleansRecipe extends Recipe { diff --git a/src/test/resources/refaster/UseStringIsEmptyRecipe.java b/src/test/resources/refaster/UseStringIsEmptyRecipe.java index 5651e27c..5e4a705b 100644 --- a/src/test/resources/refaster/UseStringIsEmptyRecipe.java +++ b/src/test/resources/refaster/UseStringIsEmptyRecipe.java @@ -37,6 +37,7 @@ /** * OpenRewrite recipe created for Refaster template `UseStringIsEmpty`. */ +@javax.annotation.Generated("org.openrewrite.java.template.processor.RefasterTemplateProcessor") @NonNullApi public class UseStringIsEmptyRecipe extends Recipe { diff --git a/src/test/resources/template/ParameterReuseRecipe$1_before.java b/src/test/resources/template/ParameterReuseRecipe$1_before.java index 844a83b3..8edd298c 100644 --- a/src/test/resources/template/ParameterReuseRecipe$1_before.java +++ b/src/test/resources/template/ParameterReuseRecipe$1_before.java @@ -16,6 +16,7 @@ package foo; import org.openrewrite.java.*; +@javax.annotation.Generated("org.openrewrite.java.template.processor.TemplateProcessor") public class ParameterReuseRecipe$1_before { public ParameterReuseRecipe$1_before() {} diff --git a/src/test/resources/template/ShouldAddClasspathRecipe$FullyQualifiedRecipe$1_after.java b/src/test/resources/template/ShouldAddClasspathRecipe$FullyQualifiedRecipe$1_after.java index b9db1545..78210c45 100644 --- a/src/test/resources/template/ShouldAddClasspathRecipe$FullyQualifiedRecipe$1_after.java +++ b/src/test/resources/template/ShouldAddClasspathRecipe$FullyQualifiedRecipe$1_after.java @@ -16,6 +16,7 @@ package foo; import org.openrewrite.java.*; +@javax.annotation.Generated("org.openrewrite.java.template.processor.TemplateProcessor") public class ShouldAddClasspathRecipes$FullyQualifiedRecipe$1_after { public ShouldAddClasspathRecipes$FullyQualifiedRecipe$1_after() {} diff --git a/src/test/resources/template/ShouldAddClasspathRecipe$FullyQualifiedRecipe$1_before.java b/src/test/resources/template/ShouldAddClasspathRecipe$FullyQualifiedRecipe$1_before.java index 6cb01fa2..76967a31 100644 --- a/src/test/resources/template/ShouldAddClasspathRecipe$FullyQualifiedRecipe$1_before.java +++ b/src/test/resources/template/ShouldAddClasspathRecipe$FullyQualifiedRecipe$1_before.java @@ -16,6 +16,7 @@ package foo; import org.openrewrite.java.*; +@javax.annotation.Generated("org.openrewrite.java.template.processor.TemplateProcessor") public class ShouldAddClasspathRecipes$FullyQualifiedRecipe$1_before { public ShouldAddClasspathRecipes$FullyQualifiedRecipe$1_before() {} diff --git a/src/test/resources/template/ShouldAddClasspathRecipe$PrimitiveRecipe$1_after.java b/src/test/resources/template/ShouldAddClasspathRecipe$PrimitiveRecipe$1_after.java index 70f612e8..aaec6257 100644 --- a/src/test/resources/template/ShouldAddClasspathRecipe$PrimitiveRecipe$1_after.java +++ b/src/test/resources/template/ShouldAddClasspathRecipe$PrimitiveRecipe$1_after.java @@ -16,6 +16,7 @@ package foo; import org.openrewrite.java.*; +@javax.annotation.Generated("org.openrewrite.java.template.processor.TemplateProcessor") public class ShouldAddClasspathRecipes$PrimitiveRecipe$1_after { public ShouldAddClasspathRecipes$PrimitiveRecipe$1_after() {} diff --git a/src/test/resources/template/ShouldAddClasspathRecipe$PrimitiveRecipe$1_before.java b/src/test/resources/template/ShouldAddClasspathRecipe$PrimitiveRecipe$1_before.java index 299e2656..a590c895 100644 --- a/src/test/resources/template/ShouldAddClasspathRecipe$PrimitiveRecipe$1_before.java +++ b/src/test/resources/template/ShouldAddClasspathRecipe$PrimitiveRecipe$1_before.java @@ -16,6 +16,7 @@ package foo; import org.openrewrite.java.*; +@javax.annotation.Generated("org.openrewrite.java.template.processor.TemplateProcessor") public class ShouldAddClasspathRecipes$PrimitiveRecipe$1_before { public ShouldAddClasspathRecipes$PrimitiveRecipe$1_before() {} diff --git a/src/test/resources/template/ShouldAddClasspathRecipe$UnqualifiedRecipe$1_after.java b/src/test/resources/template/ShouldAddClasspathRecipe$UnqualifiedRecipe$1_after.java index f559ace7..6d7e155e 100644 --- a/src/test/resources/template/ShouldAddClasspathRecipe$UnqualifiedRecipe$1_after.java +++ b/src/test/resources/template/ShouldAddClasspathRecipe$UnqualifiedRecipe$1_after.java @@ -16,6 +16,7 @@ package foo; import org.openrewrite.java.*; +@javax.annotation.Generated("org.openrewrite.java.template.processor.TemplateProcessor") public class ShouldAddClasspathRecipes$UnqualifiedRecipe$1_after { public ShouldAddClasspathRecipes$UnqualifiedRecipe$1_after() {} diff --git a/src/test/resources/template/ShouldAddClasspathRecipe$UnqualifiedRecipe$1_before.java b/src/test/resources/template/ShouldAddClasspathRecipe$UnqualifiedRecipe$1_before.java index 88795040..e59c41d6 100644 --- a/src/test/resources/template/ShouldAddClasspathRecipe$UnqualifiedRecipe$1_before.java +++ b/src/test/resources/template/ShouldAddClasspathRecipe$UnqualifiedRecipe$1_before.java @@ -16,6 +16,7 @@ package foo; import org.openrewrite.java.*; +@javax.annotation.Generated("org.openrewrite.java.template.processor.TemplateProcessor") public class ShouldAddClasspathRecipes$UnqualifiedRecipe$1_before { public ShouldAddClasspathRecipes$UnqualifiedRecipe$1_before() {} From 8b624d732f3db1e72a4089fb442c141e508c0888 Mon Sep 17 00:00:00 2001 From: Tim te Beek Date: Mon, 18 Dec 2023 12:57:16 +0100 Subject: [PATCH 2/2] Switch to `@SuppressWarnings("all")` to skip dependency --- .../template/processor/RefasterTemplateProcessor.java | 4 ++-- .../java/template/processor/TemplateProcessor.java | 2 +- src/test/resources/refaster/EscapesRecipes.java | 6 +++--- src/test/resources/refaster/MatchingRecipes.java | 4 ++-- src/test/resources/refaster/MethodThrowsRecipe.java | 2 +- .../resources/refaster/MultipleDereferencesRecipes.java | 8 ++++---- .../resources/refaster/NestedPreconditionsRecipe.java | 2 +- src/test/resources/refaster/ParameterReuseRecipe.java | 2 +- src/test/resources/refaster/ShouldAddImportsRecipes.java | 8 ++++---- .../refaster/ShouldSupportNestedClassesRecipes.java | 6 +++--- src/test/resources/refaster/SimplifyBooleansRecipe.java | 2 +- src/test/resources/refaster/UseStringIsEmptyRecipe.java | 2 +- .../resources/template/ParameterReuseRecipe$1_before.java | 2 +- ...ldAddClasspathRecipe$FullyQualifiedRecipe$1_after.java | 2 +- ...dAddClasspathRecipe$FullyQualifiedRecipe$1_before.java | 2 +- .../ShouldAddClasspathRecipe$PrimitiveRecipe$1_after.java | 2 +- ...ShouldAddClasspathRecipe$PrimitiveRecipe$1_before.java | 2 +- ...houldAddClasspathRecipe$UnqualifiedRecipe$1_after.java | 2 +- ...ouldAddClasspathRecipe$UnqualifiedRecipe$1_before.java | 2 +- 19 files changed, 31 insertions(+), 31 deletions(-) diff --git a/src/main/java/org/openrewrite/java/template/processor/RefasterTemplateProcessor.java b/src/main/java/org/openrewrite/java/template/processor/RefasterTemplateProcessor.java index 2feab8ee..e26224d6 100644 --- a/src/main/java/org/openrewrite/java/template/processor/RefasterTemplateProcessor.java +++ b/src/main/java/org/openrewrite/java/template/processor/RefasterTemplateProcessor.java @@ -182,7 +182,7 @@ public void visitClassDef(JCTree.JCClassDecl classDecl) { String refasterRuleClassName = classDecl.sym.fullname.toString().substring(classDecl.sym.packge().fullname.length() + 1); recipe.append("/**\n * OpenRewrite recipe created for Refaster template {@code ").append(refasterRuleClassName).append("}.\n */\n"); String recipeName = templateFqn.substring(templateFqn.lastIndexOf('.') + 1); - recipe.append("@javax.annotation.Generated(\"org.openrewrite.java.template.processor.RefasterTemplateProcessor\")\n"); + recipe.append("@SuppressWarnings(\"all\")\n"); recipe.append("@NonNullApi\n"); recipe.append(descriptor.classDecl.sym.outermostClass() == descriptor.classDecl.sym ? "public class " : "public static class ").append(recipeName).append(" extends Recipe {\n\n"); @@ -344,7 +344,7 @@ public void visitClassDef(JCTree.JCClassDecl classDecl) { if (outerClassRequired) { out.write("/**\n * OpenRewrite recipes created for Refaster template {@code " + inputOuterFQN + "}.\n */\n"); String outerClassName = className.substring(className.lastIndexOf('.') + 1); - out.write("@javax.annotation.Generated(\"org.openrewrite.java.template.processor.RefasterTemplateProcessor\")\n"); + out.write("@SuppressWarnings(\"all\")\n"); out.write("public class " + outerClassName + " extends Recipe {\n"); out.write(" /**\n"); out.write(" * Instantiates a new instance.\n"); diff --git a/src/main/java/org/openrewrite/java/template/processor/TemplateProcessor.java b/src/main/java/org/openrewrite/java/template/processor/TemplateProcessor.java index 77d7635a..73fd6504 100644 --- a/src/main/java/org/openrewrite/java/template/processor/TemplateProcessor.java +++ b/src/main/java/org/openrewrite/java/template/processor/TemplateProcessor.java @@ -217,7 +217,7 @@ public void visitIdent(JCTree.JCIdent ident) { out.write("\n"); out.write("/**\n * OpenRewrite `" + templateName.getValue() + "` template created for {@code " + templateFqn.split("_")[0] + "}.\n */\n"); String templateClassName = templateFqn.substring(templateFqn.lastIndexOf('.') + 1); - out.write("@javax.annotation.Generated(\"org.openrewrite.java.template.processor.TemplateProcessor\")\n"); + out.write("@SuppressWarnings(\"all\")\n"); out.write("public class " + templateClassName + " {\n"); out.write(" /**\n"); out.write(" * Instantiates a new instance.\n"); diff --git a/src/test/resources/refaster/EscapesRecipes.java b/src/test/resources/refaster/EscapesRecipes.java index 8e127541..82b89aaa 100644 --- a/src/test/resources/refaster/EscapesRecipes.java +++ b/src/test/resources/refaster/EscapesRecipes.java @@ -36,7 +36,7 @@ import com.sun.tools.javac.util.Convert; import com.sun.tools.javac.util.Constants; -@javax.annotation.Generated("org.openrewrite.java.template.processor.RefasterTemplateProcessor") +@SuppressWarnings("all") public class EscapesRecipes extends Recipe { public EscapesRecipes() {} @@ -58,7 +58,7 @@ public List getRecipeList() { ); } - @javax.annotation.Generated("org.openrewrite.java.template.processor.RefasterTemplateProcessor") + @SuppressWarnings("all") @NonNullApi public static class ConstantsFormatRecipe extends Recipe { public ConstantsFormatRecipe() {} @@ -106,7 +106,7 @@ public J visitMethodInvocation(J.MethodInvocation elem, ExecutionContext ctx) { } } - @javax.annotation.Generated("org.openrewrite.java.template.processor.RefasterTemplateProcessor") + @SuppressWarnings("all") @NonNullApi public static class SplitRecipe extends Recipe { public SplitRecipe() {} diff --git a/src/test/resources/refaster/MatchingRecipes.java b/src/test/resources/refaster/MatchingRecipes.java index 40bef7e6..5933f353 100644 --- a/src/test/resources/refaster/MatchingRecipes.java +++ b/src/test/resources/refaster/MatchingRecipes.java @@ -33,7 +33,7 @@ import static org.openrewrite.java.template.internal.AbstractRefasterJavaVisitor.EmbeddingOption.*; -@javax.annotation.Generated("org.openrewrite.java.template.processor.RefasterTemplateProcessor") +@SuppressWarnings("all") public class MatchingRecipes extends Recipe { public MatchingRecipes() {} @@ -60,7 +60,7 @@ public List getRecipeList() { ); } - @javax.annotation.Generated("org.openrewrite.java.template.processor.RefasterTemplateProcessor") + @SuppressWarnings("all") @NonNullApi public static class StringIsEmptyRecipe extends Recipe { diff --git a/src/test/resources/refaster/MethodThrowsRecipe.java b/src/test/resources/refaster/MethodThrowsRecipe.java index 6fea4c5f..d13e5279 100644 --- a/src/test/resources/refaster/MethodThrowsRecipe.java +++ b/src/test/resources/refaster/MethodThrowsRecipe.java @@ -37,7 +37,7 @@ import java.nio.file.Path; import java.nio.charset.StandardCharsets; -@javax.annotation.Generated("org.openrewrite.java.template.processor.RefasterTemplateProcessor") +@SuppressWarnings("all") @NonNullApi public class MethodThrowsRecipe extends Recipe { diff --git a/src/test/resources/refaster/MultipleDereferencesRecipes.java b/src/test/resources/refaster/MultipleDereferencesRecipes.java index 447f92ac..a9a9cbee 100644 --- a/src/test/resources/refaster/MultipleDereferencesRecipes.java +++ b/src/test/resources/refaster/MultipleDereferencesRecipes.java @@ -36,7 +36,7 @@ import java.nio.file.Files; import java.nio.file.Path; -@javax.annotation.Generated("org.openrewrite.java.template.processor.RefasterTemplateProcessor") +@SuppressWarnings("all") public class MultipleDereferencesRecipes extends Recipe { public MultipleDereferencesRecipes() {} @@ -60,7 +60,7 @@ public List getRecipeList() { ); } - @javax.annotation.Generated("org.openrewrite.java.template.processor.RefasterTemplateProcessor") + @SuppressWarnings("all") @NonNullApi public static class VoidTypeRecipe extends Recipe { @@ -108,7 +108,7 @@ public J visitMethodInvocation(J.MethodInvocation elem, ExecutionContext ctx) { } } - @javax.annotation.Generated("org.openrewrite.java.template.processor.RefasterTemplateProcessor") + @SuppressWarnings("all") @NonNullApi public static class StringIsEmptyRecipe extends Recipe { @@ -152,7 +152,7 @@ public J visitMethodInvocation(J.MethodInvocation elem, ExecutionContext ctx) { } } - @javax.annotation.Generated("org.openrewrite.java.template.processor.RefasterTemplateProcessor") + @SuppressWarnings("all") @NonNullApi public static class EqualsItselfRecipe extends Recipe { diff --git a/src/test/resources/refaster/NestedPreconditionsRecipe.java b/src/test/resources/refaster/NestedPreconditionsRecipe.java index 5a26fbc7..1bd44d33 100644 --- a/src/test/resources/refaster/NestedPreconditionsRecipe.java +++ b/src/test/resources/refaster/NestedPreconditionsRecipe.java @@ -38,7 +38,7 @@ import java.util.HashMap; import java.util.Hashtable; -@javax.annotation.Generated("org.openrewrite.java.template.processor.RefasterTemplateProcessor") +@SuppressWarnings("all") @NonNullApi public class NestedPreconditionsRecipe extends Recipe { diff --git a/src/test/resources/refaster/ParameterReuseRecipe.java b/src/test/resources/refaster/ParameterReuseRecipe.java index 6c817169..c1c7b888 100644 --- a/src/test/resources/refaster/ParameterReuseRecipe.java +++ b/src/test/resources/refaster/ParameterReuseRecipe.java @@ -33,7 +33,7 @@ import static org.openrewrite.java.template.internal.AbstractRefasterJavaVisitor.EmbeddingOption.*; -@javax.annotation.Generated("org.openrewrite.java.template.processor.RefasterTemplateProcessor") +@SuppressWarnings("all") @NonNullApi public class ParameterReuseRecipe extends Recipe { diff --git a/src/test/resources/refaster/ShouldAddImportsRecipes.java b/src/test/resources/refaster/ShouldAddImportsRecipes.java index 70711b58..ca440105 100644 --- a/src/test/resources/refaster/ShouldAddImportsRecipes.java +++ b/src/test/resources/refaster/ShouldAddImportsRecipes.java @@ -37,7 +37,7 @@ import static java.util.Objects.hash; -@javax.annotation.Generated("org.openrewrite.java.template.processor.RefasterTemplateProcessor") +@SuppressWarnings("all") public class ShouldAddImportsRecipes extends Recipe { public ShouldAddImportsRecipes() {} @@ -61,7 +61,7 @@ public List getRecipeList() { ); } - @javax.annotation.Generated("org.openrewrite.java.template.processor.RefasterTemplateProcessor") + @SuppressWarnings("all") @NonNullApi public static class StringValueOfRecipe extends Recipe { @@ -105,7 +105,7 @@ public J visitMethodInvocation(J.MethodInvocation elem, ExecutionContext ctx) { } } - @javax.annotation.Generated("org.openrewrite.java.template.processor.RefasterTemplateProcessor") + @SuppressWarnings("all") @NonNullApi public static class ObjectsEqualsRecipe extends Recipe { @@ -165,7 +165,7 @@ public J visitMethodInvocation(J.MethodInvocation elem, ExecutionContext ctx) { } } - @javax.annotation.Generated("org.openrewrite.java.template.processor.RefasterTemplateProcessor") + @SuppressWarnings("all") @NonNullApi public static class StaticImportObjectsHashRecipe extends Recipe { diff --git a/src/test/resources/refaster/ShouldSupportNestedClassesRecipes.java b/src/test/resources/refaster/ShouldSupportNestedClassesRecipes.java index c7eab94f..7b0c083e 100644 --- a/src/test/resources/refaster/ShouldSupportNestedClassesRecipes.java +++ b/src/test/resources/refaster/ShouldSupportNestedClassesRecipes.java @@ -33,7 +33,7 @@ import static org.openrewrite.java.template.internal.AbstractRefasterJavaVisitor.EmbeddingOption.*; -@javax.annotation.Generated("org.openrewrite.java.template.processor.RefasterTemplateProcessor") +@SuppressWarnings("all") public class ShouldSupportNestedClassesRecipes extends Recipe { public ShouldSupportNestedClassesRecipes() {} @@ -56,7 +56,7 @@ public List getRecipeList() { ); } - @javax.annotation.Generated("org.openrewrite.java.template.processor.RefasterTemplateProcessor") + @SuppressWarnings("all") @NonNullApi public static class NestedClassRecipe extends Recipe { @@ -100,7 +100,7 @@ public J visitBinary(J.Binary elem, ExecutionContext ctx) { } } - @javax.annotation.Generated("org.openrewrite.java.template.processor.RefasterTemplateProcessor") + @SuppressWarnings("all") @NonNullApi public static class AnotherClassRecipe extends Recipe { diff --git a/src/test/resources/refaster/SimplifyBooleansRecipe.java b/src/test/resources/refaster/SimplifyBooleansRecipe.java index d1fbfce2..f72ade77 100644 --- a/src/test/resources/refaster/SimplifyBooleansRecipe.java +++ b/src/test/resources/refaster/SimplifyBooleansRecipe.java @@ -33,7 +33,7 @@ import static org.openrewrite.java.template.internal.AbstractRefasterJavaVisitor.EmbeddingOption.*; -@javax.annotation.Generated("org.openrewrite.java.template.processor.RefasterTemplateProcessor") +@SuppressWarnings("all") @NonNullApi public class SimplifyBooleansRecipe extends Recipe { diff --git a/src/test/resources/refaster/UseStringIsEmptyRecipe.java b/src/test/resources/refaster/UseStringIsEmptyRecipe.java index 5e4a705b..200fe612 100644 --- a/src/test/resources/refaster/UseStringIsEmptyRecipe.java +++ b/src/test/resources/refaster/UseStringIsEmptyRecipe.java @@ -37,7 +37,7 @@ /** * OpenRewrite recipe created for Refaster template `UseStringIsEmpty`. */ -@javax.annotation.Generated("org.openrewrite.java.template.processor.RefasterTemplateProcessor") +@SuppressWarnings("all") @NonNullApi public class UseStringIsEmptyRecipe extends Recipe { diff --git a/src/test/resources/template/ParameterReuseRecipe$1_before.java b/src/test/resources/template/ParameterReuseRecipe$1_before.java index 8edd298c..624f99d6 100644 --- a/src/test/resources/template/ParameterReuseRecipe$1_before.java +++ b/src/test/resources/template/ParameterReuseRecipe$1_before.java @@ -16,7 +16,7 @@ package foo; import org.openrewrite.java.*; -@javax.annotation.Generated("org.openrewrite.java.template.processor.TemplateProcessor") +@SuppressWarnings("all") public class ParameterReuseRecipe$1_before { public ParameterReuseRecipe$1_before() {} diff --git a/src/test/resources/template/ShouldAddClasspathRecipe$FullyQualifiedRecipe$1_after.java b/src/test/resources/template/ShouldAddClasspathRecipe$FullyQualifiedRecipe$1_after.java index 78210c45..1c32b94f 100644 --- a/src/test/resources/template/ShouldAddClasspathRecipe$FullyQualifiedRecipe$1_after.java +++ b/src/test/resources/template/ShouldAddClasspathRecipe$FullyQualifiedRecipe$1_after.java @@ -16,7 +16,7 @@ package foo; import org.openrewrite.java.*; -@javax.annotation.Generated("org.openrewrite.java.template.processor.TemplateProcessor") +@SuppressWarnings("all") public class ShouldAddClasspathRecipes$FullyQualifiedRecipe$1_after { public ShouldAddClasspathRecipes$FullyQualifiedRecipe$1_after() {} diff --git a/src/test/resources/template/ShouldAddClasspathRecipe$FullyQualifiedRecipe$1_before.java b/src/test/resources/template/ShouldAddClasspathRecipe$FullyQualifiedRecipe$1_before.java index 76967a31..9b44ba10 100644 --- a/src/test/resources/template/ShouldAddClasspathRecipe$FullyQualifiedRecipe$1_before.java +++ b/src/test/resources/template/ShouldAddClasspathRecipe$FullyQualifiedRecipe$1_before.java @@ -16,7 +16,7 @@ package foo; import org.openrewrite.java.*; -@javax.annotation.Generated("org.openrewrite.java.template.processor.TemplateProcessor") +@SuppressWarnings("all") public class ShouldAddClasspathRecipes$FullyQualifiedRecipe$1_before { public ShouldAddClasspathRecipes$FullyQualifiedRecipe$1_before() {} diff --git a/src/test/resources/template/ShouldAddClasspathRecipe$PrimitiveRecipe$1_after.java b/src/test/resources/template/ShouldAddClasspathRecipe$PrimitiveRecipe$1_after.java index aaec6257..dc600445 100644 --- a/src/test/resources/template/ShouldAddClasspathRecipe$PrimitiveRecipe$1_after.java +++ b/src/test/resources/template/ShouldAddClasspathRecipe$PrimitiveRecipe$1_after.java @@ -16,7 +16,7 @@ package foo; import org.openrewrite.java.*; -@javax.annotation.Generated("org.openrewrite.java.template.processor.TemplateProcessor") +@SuppressWarnings("all") public class ShouldAddClasspathRecipes$PrimitiveRecipe$1_after { public ShouldAddClasspathRecipes$PrimitiveRecipe$1_after() {} diff --git a/src/test/resources/template/ShouldAddClasspathRecipe$PrimitiveRecipe$1_before.java b/src/test/resources/template/ShouldAddClasspathRecipe$PrimitiveRecipe$1_before.java index a590c895..616b5cbf 100644 --- a/src/test/resources/template/ShouldAddClasspathRecipe$PrimitiveRecipe$1_before.java +++ b/src/test/resources/template/ShouldAddClasspathRecipe$PrimitiveRecipe$1_before.java @@ -16,7 +16,7 @@ package foo; import org.openrewrite.java.*; -@javax.annotation.Generated("org.openrewrite.java.template.processor.TemplateProcessor") +@SuppressWarnings("all") public class ShouldAddClasspathRecipes$PrimitiveRecipe$1_before { public ShouldAddClasspathRecipes$PrimitiveRecipe$1_before() {} diff --git a/src/test/resources/template/ShouldAddClasspathRecipe$UnqualifiedRecipe$1_after.java b/src/test/resources/template/ShouldAddClasspathRecipe$UnqualifiedRecipe$1_after.java index 6d7e155e..335c1b94 100644 --- a/src/test/resources/template/ShouldAddClasspathRecipe$UnqualifiedRecipe$1_after.java +++ b/src/test/resources/template/ShouldAddClasspathRecipe$UnqualifiedRecipe$1_after.java @@ -16,7 +16,7 @@ package foo; import org.openrewrite.java.*; -@javax.annotation.Generated("org.openrewrite.java.template.processor.TemplateProcessor") +@SuppressWarnings("all") public class ShouldAddClasspathRecipes$UnqualifiedRecipe$1_after { public ShouldAddClasspathRecipes$UnqualifiedRecipe$1_after() {} diff --git a/src/test/resources/template/ShouldAddClasspathRecipe$UnqualifiedRecipe$1_before.java b/src/test/resources/template/ShouldAddClasspathRecipe$UnqualifiedRecipe$1_before.java index e59c41d6..2a5a4b24 100644 --- a/src/test/resources/template/ShouldAddClasspathRecipe$UnqualifiedRecipe$1_before.java +++ b/src/test/resources/template/ShouldAddClasspathRecipe$UnqualifiedRecipe$1_before.java @@ -16,7 +16,7 @@ package foo; import org.openrewrite.java.*; -@javax.annotation.Generated("org.openrewrite.java.template.processor.TemplateProcessor") +@SuppressWarnings("all") public class ShouldAddClasspathRecipes$UnqualifiedRecipe$1_before { public ShouldAddClasspathRecipes$UnqualifiedRecipe$1_before() {}