Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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.module:jackson-module-jaxb-annotations")
testRuntimeOnly("org.apache.johnzon:johnzon-core:1.2.18")
testRuntimeOnly("org.codehaus.groovy:groovy:latest.release")
testRuntimeOnly("jakarta.annotation:jakarta.annotation-api:2.1.1")
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.module.jaxb.JaxbAnnotationModule
newFullyQualifiedTypeName: com.fasterxml.jackson.module.jakarta.xmlbind.JakartaXmlBindAnnotationModule

---
type: specs.openrewrite.org/v1beta/recipe
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@

import org.junit.jupiter.api.Test;
import org.openrewrite.DocumentExample;
import org.openrewrite.Issue;
import org.openrewrite.config.Environment;
import org.openrewrite.java.JavaParser;
import org.openrewrite.test.RecipeSpec;
Expand Down Expand Up @@ -294,4 +295,40 @@ private JSONPModule getModule() {
)
);
}

@Issue("https://github.com/openrewrite/rewrite-migrate-java/issues/652")
@Test
void thatJaxbAnnotationModuleIsRewritten() {
rewriteRun(
spec -> spec.parser(JavaParser.fromJavaVersion().classpath(
"jackson-core",
"jackson-databind",
"jackson-module-jaxb-annotations")),
//language=java
java(
"""
import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.module.jaxb.JaxbAnnotationModule;

public class JacksonTest {
void foo() {
ObjectMapper mapper = new ObjectMapper();
mapper.registerModule(new JaxbAnnotationModule());
}
}
""",
"""
import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.module.jakarta.xmlbind.JakartaXmlBindAnnotationModule;

public class JacksonTest {
void foo() {
ObjectMapper mapper = new ObjectMapper();
mapper.registerModule(new JakartaXmlBindAnnotationModule());
}
}
"""
)
);
}
}
Loading