Skip to content

Commit 58162cf

Browse files
committed
GROOVY-7785: Stack overflow when using too many chained method calls (guard test to pin current behavior: indy only not classic)
1 parent e3c89fd commit 58162cf

1 file changed

Lines changed: 9 additions & 0 deletions

File tree

src/test/groovy/bugs/Groovy7785.groovy

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,13 +20,22 @@ package bugs
2020

2121
import org.junit.jupiter.api.Disabled
2222
import org.junit.jupiter.api.Test
23+
import org.junit.jupiter.api.condition.DisabledIfSystemProperty
2324

2425
import static groovy.test.GroovyAssert.assertScript
2526

2627
/**
2728
* Tests for GROOVY-7785: StackOverflowError with deeply nested chained method calls.
2829
* Each test uses chained method calls to verify the fix handles deep chains.
30+
* <p>
31+
* The fix (iterative chain flattening) is implemented in the invokedynamic
32+
* writer only; classic bytecode generation still overflows the stack on very
33+
* deep call chains. Classic is being phased out, so this is a documented
34+
* limitation rather than a bug to fix — hence the tests are skipped when
35+
* compiling with {@code groovy.target.indy=false}.
2936
*/
37+
@DisabledIfSystemProperty(named = 'groovy.target.indy', matches = '(?i)false',
38+
disabledReason = 'GROOVY-7785 deep-chain flattening is indy-only; classic codegen overflows on very deep chains')
3039
final class Groovy7785 {
3140

3241
@Test

0 commit comments

Comments
 (0)