I am using the Gradle plugin to run ChangeType recipes.
What is the smallest, simplest way to reproduce the problem?
I have created the test here. The test is a change type recipe for an annotation class that is used with a use site target. When run the import is not added for the new Target annotation.
After stepping through the code I am starting to believe that for some reason the AddImport visitor is not actually causing the issue because when the type is changed the underlying type in use isn't changed. To explain using the annotations from the linked test, it doesn't add an import for the Target annotation because it thinks that the Target annotation added actually has the type a.b.Original.
This has now been fixed and will be included in the next release. You can expect a new release within the next two weeks. In the mean time you can use snapshot builds, which should already be available.
What version of OpenRewrite are you using?
I am using
How are you running OpenRewrite?
I am using the Gradle plugin to run ChangeType recipes.
What is the smallest, simplest way to reproduce the problem?
I have created the test here. The test is a change type recipe for an annotation class that is used with a use site target. When run the import is not added for the new
Target
annotation.After stepping through the code I am starting to believe that for some reason the
AddImport
visitor is not actually causing the issue because when the type is changed the underlying type in use isn't changed. To explain using the annotations from the linked test, it doesn't add an import for theTarget
annotation because it thinks that theTarget
annotation added actually has the typea.b.Original
.Are you interested in contributing a fix to OpenRewrite?
If I figure out the source of this issue I might be able to fix it but there is a good chance I will not be able to fix it.