Open nddipiazza-ebay opened 1 month ago
Hmm can you provide a reproducer? I am seeing the imports get created in a couple of project I have run it on?
Would also help to know what version you're using, and indeed ideally as a failing unit test, as per this example. https://github.com/openrewrite/rewrite-static-analysis/blob/2163f0f05dd6fe7f4762e3486c8f16a9a5787036/src/test/java/org/openrewrite/staticanalysis/AddSerialAnnotationToSerialVersionUIDTest.java#L34-L57
Adding the annotation is directly above adding the annotation, so I wouldn't expect any issue. https://github.com/openrewrite/rewrite-static-analysis/blob/2163f0f05dd6fe7f4762e3486c8f16a9a5787036/src/main/java/org/openrewrite/staticanalysis/AddSerialAnnotationToSerialVersionUID.java#L71-L78
mvn -U "org.openrewrite.maven:rewrite-maven-plugin:run" "-Drewrite.recipeArtifactCoordinates=org.openrewrite.recipe:rewrite-migrate-java:LATEST,org.openrewrite.recipe:rewrite-testing-frameworks:LATEST,org.openrewrite.recipe:rewrite-spring:LATEST" "-Drewrite.activeRecipes=org.openrewrite.java.spring.boot2.SpringBoot2JUnit4to5Migration,org.openrewrite.java.testing.cleanup.TestsShouldNotBePublic,org.openrewrite.java.migrate.UpgradeToJava17,org.openrewrite.java.testing.mockito.ReplacePowerMockito,org.openrewrite.maven.RemoveDuplicateDependencies"
result:
That's odd; and what version of Java are you running when you invoke that mvn
command above? I wonder if you'd see any improvements if you use Java 17 to run that command instead.
Issue with
org.openrewrite.staticanalysis.AddSerialAnnotationToSerialVersionUID
As a result of addressing https://github.com/openrewrite/rewrite-migrate-java/issues/96
@Serial
was added to anyserialVersionUID
field in Serializable classes.But the import was forgotten resulting in