Skip to content

Commit 708e03c

Browse files
committed
fix: bump Groovy to 5.0.5 with GROOVY-11907 workaround
Groovy 5.0.4+ bundles ASM 9.9.1 which rejects the invalid bytecode generated by TraitReceiverTransformer for @CompileStatic traits with static fields when method-level DYNAMIC_RESOLUTION is present (GROOVY-11907, a regression from GROOVY-11817). The only affected trait in grails-geb testFixtures is ContainerSupport (static fields: container, downloadSupport). Switch it from @CompileStatic to @CompileDynamic so its helper class compiles via the dynamic code path, which generates valid bytecode. ContainerGebSpec retains @CompileStatic - its delegate stubs are simple forwarding calls unaffected by the bug. This unblocks the Groovy 5.0.3 -> 5.0.5 upgrade. Revert to @CompileStatic once the Groovy fix (apache/groovy#2443) ships. Assisted-by: Claude Code <Claude@Claude.ai>
1 parent 7896ef8 commit 708e03c

2 files changed

Lines changed: 7 additions & 3 deletions

File tree

dependencies.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ ext {
7474
'commons-codec.version' : '1.18.0',
7575
'commons-lang3.version' : '3.20.0',
7676
'geb-spock.version' : '8.0.1',
77-
'groovy.version' : '5.0.3',
77+
'groovy.version' : '5.0.5',
7878
'jackson.version' : '2.21.2',
7979
'jquery.version' : '3.7.1',
8080
'liquibase-hibernate5.version': '4.27.0',

grails-geb/src/testFixtures/groovy/grails/plugin/geb/support/ContainerSupport.groovy

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
*/
1919
package grails.plugin.geb.support
2020

21-
import groovy.transform.CompileStatic
21+
import groovy.transform.CompileDynamic
2222
import groovy.transform.SelfType
2323

2424
import geb.download.DownloadSupport
@@ -34,7 +34,11 @@ import grails.plugin.geb.ContainerGebSpec
3434
* @author Mattias Reichel
3535
* @since 4.2
3636
*/
37-
@CompileStatic
37+
// GROOVY-11907: @CompileStatic on a trait with static fields generates invalid
38+
// bytecode when method-level DYNAMIC_RESOLUTION is present (ASM 9.9.1 rejects it).
39+
// Use @CompileDynamic until the Groovy fix is released, then restore @CompileStatic.
40+
// See: https://issues.apache.org/jira/browse/GROOVY-11907
41+
@CompileDynamic
3842
@SelfType(ContainerGebSpec)
3943
trait ContainerSupport implements DownloadSupport {
4044

0 commit comments

Comments
 (0)