Open timyates opened 4 months ago
Could it be that both TypeElementVisitorTransform
and FunctionTransform
in micronaut-groovy
both use CompilePhase.SEMANTIC_ANALYSIS
, and there's no guarantee of order for AST transformations in the same Phase?
I don't know much about Groovy, but you can try to find what changed vs. the version that worked.
Thanks for opening this issue @timyates. This is a blocker for four PRs I am trying to resolve for micronaut-groovy.
I don't know much about Groovy, but you can try to find what changed vs. the version that worked.
It currently makes no sense... It seems to work with core afdc5e835feff99bb9c65c2972f8b0029ec3294e
But fails with the next commit...fa244031e612d75b3994146e31e177e1ff1734e2
All that changes is the version property... I suspect something else is going on...
I don't know if transform order is the problem, but in Groovy 4+, if a transform implements TransformWithPriority
, you can override the processing order of transforms within the same phase by setting a priority
. They are run in order of source code appearance if in the same phase with the same priority. The transformation with the highest positive priority will be processed first. Negative priorities will be processed after all transformations with a priority of zero (the default).
I must be wrong and something else must be causing the problem...
I updated the FunctionTransform
to implement TransformWithPriority
and return a priority of 1, and the issue remains
Back to confused for me ;-)
Issue description
The upgrade to core 4.3.0 seems to have broken running groovy scripts as Functions as REST services
Reproducer
Check out
master
of micronaut-groovy, and run:The 4 REST tests will fail
If we switch micronaut-core back to 4.2.4 then the tests pass...
Suspicions
I suspect what is happening is the Bean definition is getting written BEFORE the AST transformation is occuring.
This means that in the class
$NotifyWithArgsFunction$Definition$Reference.class
with 4.3.x we get$ANNOTATION_METADATA
set toWheras with micronaut 4.2.4, it is: