Closed timtebeek closed 7 months ago
So the OpenRewrite repositories are a great use case for this as the rewrite-build-gradle-plugin does just this.
If the dependency is on the compileOnly
configurarion, I'd expect for that to propagate into the compileClasspath
configuration which is handed to the *Parser
instances responsible for performing the parsing into the LST elements.
Looks to be fixed now! š
So couple hypotheticals: say you have some company wide Gradle convention plugins, that among other things, add Lombok to project dependencies from a
conventions/src/main/groovy/io.moo.java-base.gradle
And you then use this plugin with some indirections via a
library
plugin, to ajava-17
plugin, to thatbase.gradle
plugin in a library, and run the rewrite-gradle-plugin against that library.What you would expect is for the
lombok
classes to still be available to the Gradle parser for type attribution, and for those types to make it onto LST elements for recipes to discover and use.Yet what you might find is that
FindMissingTypes
flags all Lombok annotations themselves as missing types, not the boilerplate they generate. This then trips upLombokValToFinalVar
and ends up removing "unused" imports. (all hypothetical)We should support such use cases by making sure that any dependencies added through plugins are also added to the parser classpath, or if they already are, troubleshoot why there's missing types on such uses.