Closed aholland closed 7 months ago
Thanks for the detailed report! No idea what might have caused this yet, but definitely something we should fix.
I'm mostly expecting the version of the rewrite-recipe-bom to play in here though, not as much the version of the plugin. Did you bump those in sync? What version did you use with Gradle plugin 6.6.4?
We typically list the version that work well together on the release notes here: https://github.com/openrewrite/rewrite-recipe-bom/releases
We did have someone report a regression to our types in use, which feeds into remove unused imports:
Perhaps the fix is already in the latest snapshots for you? See our snapshot versions too
The latest.integration
version of plugin also removes all the Lombok imports I'm afraid. All I change is the version of the plugin from latest.integration
to 6.6.4
and it works fine.
There was a regression in TypesInUse that was fixed in openrewrite/rewrite v8.13.4+ https://github.com/openrewrite/rewrite/commit/b716dc3e3d1d1d1d456027ecbc1910fff6b383d3
From the releases page it seems rewrite-gradle-plugin 6.7+ would have been the first to pick up that fix; could you try https://github.com/openrewrite/rewrite-gradle-plugin/releases/tag/v6.7.1 ? 🙏🏻
Sorry to report 6.7.1
has exactly the same behaviour as 6.6.5
through 6.7.0
. That's not surprising though because yesterday I tried latest.integration
which is after 6.7.1
.
Thanks again for the report @aholland ! We saw a similar issue with Lombok yesterday, which led to the following change (a revert)
This has been releases as part of v6.8.1 of the rewrite-gradle-plugin; would you mind telling us if that indeed fixes it for you too?
I'm going to assume the new release has indeed fixed things for you. Let me know if that's any different!
What version of OpenRewrite are you using?
I have tried multiple versions, of this plugin. The problem occurs with 6.6.5 and up. 6.6.4 is okay.
I am using
How are you running OpenRewrite?
Gradle plugin
Project not public unfortunately.
To reproduce:
Run on this file:
./gradlew rewriteRun
with plugin 6.6.4 will produce this:But 6.6.5 and up will produce this, leaving out the Lombok imports, so the code won't compile, and it will do this across hundreds of files:
What is the smallest, simplest way to reproduce the problem?
./gradlew rewriteRun
What did you expect to see?
Version of code with lombok imports.
What did you see instead?
Version of code with no lombok imports.
What is the full stack trace of any errors you encountered?
There is no exception thrown.
Are you interested in contributing a fix to OpenRewrite?
I might be willing - pretty busy in my role though so not sure when I would get onto it. More likely, since this was introduced last week between 6.6.4 and 6.6.5, that developer will be able to see what has happened quite quickly.