The GitHub Actions job "CI" on grails-core.git/grails8-groovy6-canary has 
failed.
Run started by GitHub user jamesfredley (triggered by jamesfredley).

Head commit for run:
c2aa269e5400b5da9877d685043d77192a85fb16 / James Fredley 
<[email protected]>
fix: Groovy 6 closure dispatch regression in ControllerActionTransformer

A fresh Groovy 6.0.0-SNAPSHOT pull broke grails-rest-transforms compile:

  Execution failed for task ':grails-rest-transforms:compileGroovy'.
  > Unrecoverable compilation error: startup failed:
    General error during semantic analysis: No signature of method:
    doCall for class: ControllerActionTransformer$1 is applicable for
    argument types: (org.codehaus.groovy.ast.MethodNode) values:
    [org.codehaus.groovy.ast.MethodNode@... index(java.lang.Integer)
    from grails.rest.RestfulController]

The transformer used `DefaultGroovyMethods.count(Iterable, Closure)` with
an inline anonymous Closure subclass that overrode `call(Object)`. Under
Groovy 5 that dispatched via Closure.call(Object) directly. Under Groovy 6
the count helper now goes through MOP `doCall` lookup first, and a Java
inner class overriding `call(Object)` does not advertise a matching
`doCall(MethodNode)`, so dispatch fails at compile time when the AST
transform itself runs against any controller subclass that has typed
overload methods on the supertype (e.g. RestfulController.index(Integer)).

The Closure roundtrip is unnecessary here. Replace it with a plain Java
counting loop. This is shorter, allocates no Closure, removes the
implicit MOP dependency entirely, and works on every Groovy version. The
DefaultGroovyMethods import is no longer used in this file, so remove it
too.

Verified locally:
  ./gradlew :grails-rest-transforms:compileGroovy -PskipCodeStyle
  -> BUILD SUCCESSFUL in 29s

Other `new Closure(this)` sites in the codebase use either no-arg call()
or call(Object...) varargs and were not affected by the new MOP path; if
that changes those should get the same treatment.

Assisted-by: claude-code:claude-opus-4-7

Report URL: https://github.com/apache/grails-core/actions/runs/24920513671

With regards,
GitHub Actions via GitBox

Reply via email to