File tree Expand file tree Collapse file tree 3 files changed +41
-0
lines changed
main/resources/META-INF/rewrite
test/java/org/openrewrite/java/migrate/jakarta Expand file tree Collapse file tree 3 files changed +41
-0
lines changed Original file line number Diff line number Diff line change @@ -56,6 +56,7 @@ dependencies {
5656 testRuntimeOnly(" com.fasterxml.jackson.datatype:jackson-datatype-jsr353" )
5757 testRuntimeOnly(" com.fasterxml.jackson.core:jackson-core" )
5858 testRuntimeOnly(" com.fasterxml.jackson.core:jackson-databind" )
59+ testRuntimeOnly(" com.fasterxml.jackson.module:jackson-module-jaxb-annotations" )
5960 testRuntimeOnly(" org.apache.johnzon:johnzon-core:1.2.18" )
6061 testRuntimeOnly(" org.codehaus.groovy:groovy:latest.release" )
6162 testRuntimeOnly(" jakarta.annotation:jakarta.annotation-api:2.1.1" )
Original file line number Diff line number Diff line change @@ -918,6 +918,9 @@ recipeList:
918918 - org.openrewrite.java.ChangeType :
919919 oldFullyQualifiedTypeName : com.fasterxml.jackson.datatype.jsr353.JSR353Module
920920 newFullyQualifiedTypeName : com.fasterxml.jackson.datatype.jsonp.JSONPModule
921+ - org.openrewrite.java.ChangeType :
922+ oldFullyQualifiedTypeName : com.fasterxml.jackson.module.jaxb.JaxbAnnotationModule
923+ newFullyQualifiedTypeName : com.fasterxml.jackson.module.jakarta.xmlbind.JakartaXmlBindAnnotationModule
921924
922925---
923926type : specs.openrewrite.org/v1beta/recipe
Original file line number Diff line number Diff line change 1717
1818import org .junit .jupiter .api .Test ;
1919import org .openrewrite .DocumentExample ;
20+ import org .openrewrite .Issue ;
2021import org .openrewrite .config .Environment ;
2122import org .openrewrite .java .JavaParser ;
2223import org .openrewrite .test .RecipeSpec ;
@@ -294,4 +295,40 @@ private JSONPModule getModule() {
294295 )
295296 );
296297 }
298+
299+ @ Issue ("https://github.com/openrewrite/rewrite-migrate-java/issues/652" )
300+ @ Test
301+ void thatJaxbAnnotationModuleIsRewritten () {
302+ rewriteRun (
303+ spec -> spec .parser (JavaParser .fromJavaVersion ().classpath (
304+ "jackson-core" ,
305+ "jackson-databind" ,
306+ "jackson-module-jaxb-annotations" )),
307+ //language=java
308+ java (
309+ """
310+ import com.fasterxml.jackson.databind.ObjectMapper;
311+ import com.fasterxml.jackson.module.jaxb.JaxbAnnotationModule;
312+
313+ public class JacksonTest {
314+ void foo() {
315+ ObjectMapper mapper = new ObjectMapper();
316+ mapper.registerModule(new JaxbAnnotationModule());
317+ }
318+ }
319+ """ ,
320+ """
321+ import com.fasterxml.jackson.databind.ObjectMapper;
322+ import com.fasterxml.jackson.module.jakarta.xmlbind.JakartaXmlBindAnnotationModule;
323+
324+ public class JacksonTest {
325+ void foo() {
326+ ObjectMapper mapper = new ObjectMapper();
327+ mapper.registerModule(new JakartaXmlBindAnnotationModule());
328+ }
329+ }
330+ """
331+ )
332+ );
333+ }
297334}
You can’t perform that action at this time.
0 commit comments