diff --git a/build.gradle.kts b/build.gradle.kts index 26fec7a18..99a1d51a8 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -56,6 +56,7 @@ dependencies { testRuntimeOnly("com.fasterxml.jackson.datatype:jackson-datatype-jsr353") testRuntimeOnly("com.fasterxml.jackson.core:jackson-core") testRuntimeOnly("com.fasterxml.jackson.core:jackson-databind") + testRuntimeOnly("com.fasterxml.jackson.jaxrs:jackson-jaxrs-json-provider") testRuntimeOnly("com.fasterxml.jackson.module:jackson-module-jaxb-annotations") testRuntimeOnly("org.apache.johnzon:johnzon-core:1.2.18") testRuntimeOnly("org.codehaus.groovy:groovy:latest.release") diff --git a/src/main/resources/META-INF/rewrite/jakarta-ee-9.yml b/src/main/resources/META-INF/rewrite/jakarta-ee-9.yml index 9adba307b..3883b3339 100644 --- a/src/main/resources/META-INF/rewrite/jakarta-ee-9.yml +++ b/src/main/resources/META-INF/rewrite/jakarta-ee-9.yml @@ -918,6 +918,9 @@ recipeList: - org.openrewrite.java.ChangeType: oldFullyQualifiedTypeName: com.fasterxml.jackson.datatype.jsr353.JSR353Module newFullyQualifiedTypeName: com.fasterxml.jackson.datatype.jsonp.JSONPModule + - org.openrewrite.java.ChangeType: + oldFullyQualifiedTypeName: com.fasterxml.jackson.jaxrs.json.JacksonJaxbJsonProvider + newFullyQualifiedTypeName: com.fasterxml.jackson.jakarta.rs.json.JacksonXmlBindJsonProvider - org.openrewrite.java.ChangeType: oldFullyQualifiedTypeName: com.fasterxml.jackson.module.jaxb.JaxbAnnotationModule newFullyQualifiedTypeName: com.fasterxml.jackson.module.jakarta.xmlbind.JakartaXmlBindAnnotationModule diff --git a/src/test/java/org/openrewrite/java/migrate/jakarta/JacksonJavaxtoJakartaTest.java b/src/test/java/org/openrewrite/java/migrate/jakarta/JacksonJavaxtoJakartaTest.java index 1d9af9bc6..d35ebf18f 100644 --- a/src/test/java/org/openrewrite/java/migrate/jakarta/JacksonJavaxtoJakartaTest.java +++ b/src/test/java/org/openrewrite/java/migrate/jakarta/JacksonJavaxtoJakartaTest.java @@ -331,4 +331,27 @@ void foo() { ) ); } + + @Issue("https://github.com/openrewrite/rewrite-migrate-java/issues/653") + @Test + void thatJaxbJsonProviderIsRewritten() { + rewriteRun( + spec -> spec.parser(JavaParser.fromJavaVersion().classpath( + "jackson-databind", + "jackson-jaxrs-json-provider")), + //language=java + java( + """ + import com.fasterxml.jackson.jaxrs.json.JacksonJaxbJsonProvider; + + public class A extends JacksonJaxbJsonProvider {} + """, + """ + import com.fasterxml.jackson.jakarta.rs.json.JacksonXmlBindJsonProvider; + + public class A extends JacksonXmlBindJsonProvider {} + """ + ) + ); + } }