Groovy code cannot reference classes generated in the same compilation
Classes generated during a compilation, for example by a TypeElementVisitor with micronaut-sourcegen, cannot be referenced by Groovy code of the same compilation: the Groovy sources are resolved before the generated sources exist, so the build fails with an unresolved class. Java (annotation processing) and Kotlin (KSP) resolve them.
Example from micronaut-hateoas: @GenerateLinks on a controller generates BookControllerLinks. A Groovy class in the same source set that calls BookControllerLinks.show(id) does not compile. Code in a later compilation (for example the tests) can use it.
5.3 compiles generated Groovy sources, which helps for generated code, but not for hand-written Groovy code that references generated types in the same compilation.
Workaround: micronaut-hateoas documents LinkBuilder, the runtime equivalent, for Groovy code in the controller's compilation.
Source: micronaut-projects/micronaut-core