Skip to content

Commit

Permalink
[JacksonJavaxToJakarta] Rewrite JacksonJaxbJsonProvider to JacksonXml…
Browse files Browse the repository at this point in the history
…BindJsonProvider (#655)

* Rewrite JacksonJaxbJsonProvider to JacksonXmlBindJsonProvider

* Add missing runtime dependency

---------

Co-authored-by: Tim te Beek <[email protected]>
  • Loading branch information
FieteO and timtebeek authored Jan 5, 2025
1 parent b3bb13c commit 46a5d0a
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 0 deletions.
1 change: 1 addition & 0 deletions build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand Down
3 changes: 3 additions & 0 deletions src/main/resources/META-INF/rewrite/jakarta-ee-9.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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 {}
"""
)
);
}
}

0 comments on commit 46a5d0a

Please sign in to comment.