From 3375005097a10fcd718c2fa71e593aff4d399643 Mon Sep 17 00:00:00 2001 From: Jonathan Schneider Date: Wed, 6 Sep 2023 00:14:34 -0400 Subject: [PATCH] Fix deserializability of AddJaxbRuntime --- .../java/migrate/javax/AddJaxbRuntime.java | 28 +++++++------------ 1 file changed, 10 insertions(+), 18 deletions(-) diff --git a/src/main/java/org/openrewrite/java/migrate/javax/AddJaxbRuntime.java b/src/main/java/org/openrewrite/java/migrate/javax/AddJaxbRuntime.java index 034b1b3539..10e8d54133 100644 --- a/src/main/java/org/openrewrite/java/migrate/javax/AddJaxbRuntime.java +++ b/src/main/java/org/openrewrite/java/migrate/javax/AddJaxbRuntime.java @@ -33,9 +33,9 @@ import java.time.Duration; import java.util.*; -@EqualsAndHashCode(callSuper = true) +@Value +@EqualsAndHashCode(callSuper = false) public class AddJaxbRuntime extends Recipe { - private static final String JAKARTA_API_GROUP = "jakarta.xml.bind"; private static final String JAKARTA_API_ARTIFACT = "jakarta.xml.bind-api"; @@ -49,16 +49,7 @@ public class AddJaxbRuntime extends Recipe { description = "Which implementation of the JAXB run-time that will be added to maven projects that have transitive dependencies on the JAXB API", valid = {"glassfish", "sun"}, example = "glassfish") - private final String runtime; - - private final AddJaxbRuntimeGradle addJaxbRuntimeGradle; - private final AddJaxbRuntimeMaven addJaxbRuntimeMaven; - - public AddJaxbRuntime(String runtime) { - this.runtime = runtime; - this.addJaxbRuntimeGradle = new AddJaxbRuntimeGradle(runtime); - this.addJaxbRuntimeMaven = new AddJaxbRuntimeMaven(runtime); - } + String runtime; @Override public String getDisplayName() { @@ -91,12 +82,12 @@ public boolean causesAnotherCycle() { @Override public List getRecipeList() { - return Arrays.asList(addJaxbRuntimeGradle, addJaxbRuntimeMaven); + return Arrays.asList(new AddJaxbRuntimeGradle(runtime), new AddJaxbRuntimeMaven(runtime)); } @Value - @EqualsAndHashCode(callSuper = true) - private static class AddJaxbRuntimeGradle extends Recipe { + @EqualsAndHashCode(callSuper = false) + static class AddJaxbRuntimeGradle extends Recipe { String runtime; @Override @@ -216,8 +207,8 @@ private org.openrewrite.gradle.AddDependencyVisitor addDependency(String configu } @Value - @EqualsAndHashCode(callSuper = true) - private static class AddJaxbRuntimeMaven extends Recipe { + @EqualsAndHashCode(callSuper = false) + static class AddJaxbRuntimeMaven extends Recipe { String runtime; @Override @@ -324,4 +315,5 @@ private Scope getTransitiveDependencyScope(MavenResolutionResult mavenModel, Str }; } } -} + +} \ No newline at end of file