From 2e9ca49ddf182f3a59c650e8a58d5810ea161fe0 Mon Sep 17 00:00:00 2001 From: Tim te Beek Date: Fri, 8 Dec 2023 19:28:37 +0000 Subject: [PATCH] refactor: OpenRewrite recipe best practices Use this link to re-run the recipe: https://app.moderne.io/recipes/builder/XX1hrwagC?organizationId=T3BlblJld3JpdGU%3D Co-authored-by: Moderne --- .../org/openrewrite/hibernate/TypeAnnotationParameter.java | 4 ++-- .../openrewrite/hibernate/TypeAnnotationParameterTest.java | 6 ++++-- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/src/main/java/org/openrewrite/hibernate/TypeAnnotationParameter.java b/src/main/java/org/openrewrite/hibernate/TypeAnnotationParameter.java index ce1e546..e33f20f 100644 --- a/src/main/java/org/openrewrite/hibernate/TypeAnnotationParameter.java +++ b/src/main/java/org/openrewrite/hibernate/TypeAnnotationParameter.java @@ -51,8 +51,8 @@ public String getDescription() { public TreeVisitor getVisitor() { return new JavaIsoVisitor() { @Override - public J.Annotation visitAnnotation(J.Annotation annotation, ExecutionContext executionContext) { - J.Annotation a = super.visitAnnotation(annotation, executionContext); + public J.Annotation visitAnnotation(J.Annotation annotation, ExecutionContext ctx) { + J.Annotation a = super.visitAnnotation(annotation, ctx); JavaType.FullyQualified type = TypeUtils.asFullyQualified(a.getType()); if (type != null && FQN_TYPE_ANNOTATION.equals(type.getFullyQualifiedName())) { final boolean isOnlyParameter = a.getArguments().size() == 1; diff --git a/src/test/java/org/openrewrite/hibernate/TypeAnnotationParameterTest.java b/src/test/java/org/openrewrite/hibernate/TypeAnnotationParameterTest.java index 9c41437..6432e00 100644 --- a/src/test/java/org/openrewrite/hibernate/TypeAnnotationParameterTest.java +++ b/src/test/java/org/openrewrite/hibernate/TypeAnnotationParameterTest.java @@ -32,7 +32,8 @@ public void defaults(RecipeSpec spec) { void onlyOneParameter() { rewriteRun( //language=java - java(""" + java( + """ import org.hibernate.annotations.Type; public class TestApplication { @@ -58,7 +59,8 @@ public class TestApplication { void multipleParameters() { rewriteRun( //language=java - java(""" + java( + """ import org.hibernate.annotations.Type; class TestApplication {