Skip to content

Commit

Permalink
refactor: OpenRewrite recipe best practices
Browse files Browse the repository at this point in the history
  • Loading branch information
timtebeek and TeamModerne committed Dec 8, 2023
1 parent 423784d commit 2e9ca49
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -51,8 +51,8 @@ public String getDescription() {
public TreeVisitor<?, ExecutionContext> getVisitor() {
return new JavaIsoVisitor<ExecutionContext>() {
@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;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,8 @@ public void defaults(RecipeSpec spec) {
void onlyOneParameter() {
rewriteRun(
//language=java
java("""
java(
"""
import org.hibernate.annotations.Type;
public class TestApplication {
Expand All @@ -58,7 +59,8 @@ public class TestApplication {
void multipleParameters() {
rewriteRun(
//language=java
java("""
java(
"""
import org.hibernate.annotations.Type;
class TestApplication {
Expand Down

0 comments on commit 2e9ca49

Please sign in to comment.