Skip to content

GROOVY-11792: for-in loop variable captured by closure/AIC sees final value, not per-iteration value - #2732

Merged
daniellansun merged 2 commits into
masterfrom
GROOVY-11792
Jul 26, 2026
Merged

GROOVY-11792: for-in loop variable captured by closure/AIC sees final value, not per-iteration value#2732
daniellansun merged 2 commits into
masterfrom
GROOVY-11792

Conversation

@daniellansun

Copy link
Copy Markdown
Contributor

@github-actions github-actions Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Performance Alert ⚠️

Possible performance regression was detected for benchmark.
Benchmark result of this commit is worse than the previous benchmark result exceeding threshold 1.50.

Benchmark suite Current: 1d013d9 Previous: c513a3a Ratio
org.apache.groovy.bench.CalibrationBench.memoryPointerChase 1006.5323072503194 us/op 574.7046880620453 us/op 1.75

This comment was automatically generated by workflow using github-action-benchmark.

@codecov-commenter

codecov-commenter commented Jul 23, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 69.4017%. Comparing base (c513a3a) to head (1d013d9).
⚠️ Report is 12 commits behind head on master.

Additional details and impacted files

Impacted file tree graph

@@                Coverage Diff                 @@
##               master      #2732        +/-   ##
==================================================
+ Coverage     69.3657%   69.4017%   +0.0359%     
- Complexity      35082      35100        +18     
==================================================
  Files            1553       1553                
  Lines          131490     131517        +27     
  Branches        24045      24047         +2     
==================================================
+ Hits            91209      91275        +66     
+ Misses          32045      31994        -51     
- Partials         8236       8248        +12     
Files with missing lines Coverage Δ
...org/codehaus/groovy/classgen/asm/CompileStack.java 86.5707% <100.0000%> (+0.2627%) ⬆️
...haus/groovy/classgen/asm/DelegatingController.java 92.0635% <100.0000%> (+0.1280%) ⬆️
.../codehaus/groovy/classgen/asm/StatementWriter.java 99.2537% <100.0000%> (+2.2840%) ⬆️
...codehaus/groovy/classgen/asm/WriterController.java 88.4354% <100.0000%> (+2.3243%) ⬆️
...vy/classgen/asm/sc/StaticTypesStatementWriter.java 98.4252% <100.0000%> (ø)
...codehaus/groovy/control/CompilerConfiguration.java 73.6156% <100.0000%> (+0.7968%) ⬆️

... and 10 files with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@github-actions

github-actions Bot commented Jul 23, 2026

Copy link
Copy Markdown
Contributor

JMH summary — classic (commit 9de1c05)

Speedup vs trailing 90-day baseline on gh-pages. Higher = faster.
1.00 = in line with history. Per-benchmark ratio, geomean within group.
Time-per-op units inverted so direction is consistent. The calibrated
column divides out this runner's speed vs the baseline hardware, as
measured by Groovy-independent pure-Java ruler benchmarks.

Group Speedup Calibrated n
bench 1.240 × 1.027 × 92
core 1.071 × 1.077 × 77
grails 1.013 × 1.024 × 80

⚠️ Runner speed differs ≥15% from the historical baseline hardware for: bench. Raw speedups are not meaningful for those parts — use the calibrated column.

Runner calibration (this run vs baseline hardware): bench 1.21× (26 rulers) · core-ag 0.99× (3 rulers) · core-hz 1.00× (3 rulers) · grails-ad 0.97× (3 rulers) · grails-ez 1.00× (3 rulers)

Baseline: dev/bench/jmh/<part>/classic/data.js on gh-pages, trailing 90 days. Daily dashboard · Per-suite raw data

@github-actions

github-actions Bot commented Jul 23, 2026

Copy link
Copy Markdown
Contributor

JMH summary — indy (commit 9de1c05)

Speedup vs trailing 90-day baseline on gh-pages. Higher = faster.
1.00 = in line with history. Per-benchmark ratio, geomean within group.
Time-per-op units inverted so direction is consistent. The calibrated
column divides out this runner's speed vs the baseline hardware, as
measured by Groovy-independent pure-Java ruler benchmarks.

Group Speedup Calibrated n
bench 0.992 × 0.976 × 92
core 3.537 × 3.615 × 77
grails 2.838 × 2.591 × 80

⚠️ Runner speed differs ≥15% from the historical baseline hardware for: grails-ez. Raw speedups are not meaningful for those parts — use the calibrated column.

Runner calibration (this run vs baseline hardware): bench 1.01× (26 rulers) · core-ag 0.99× (3 rulers) · core-hz 0.96× (3 rulers) · grails-ad 0.98× (3 rulers) · grails-ez 1.20× (3 rulers)

Baseline: dev/bench/jmh/<part>/indy/data.js on gh-pages, trailing 90 days. Daily dashboard · Per-suite raw data

@blackdrag blackdrag left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you add a test for the bytecode as well? Best would be a test that checks the old bytecode pattern for not being produced and a test checking for the new bytecode pattern. That also clearly documents the change

@daniellansun

Copy link
Copy Markdown
Contributor Author

Could you add a test for the bytecode as well? Best would be a test that checks the old bytecode pattern for not being produced and a test checking for the new bytecode pattern. That also clearly documents the change

Hi Jochen, does the commit to add the test looks OK to you?
1197010

@paulk-asert paulk-asert left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Approved but consider the following naming suggestion:

Flag naming, now rather than later. groovy.for.loop.capture / setForLoopCaptureEnabled doesn't say what it controls: classic for loops are not affected despite the name, and capture=false reads like "captures disabled" rather than "legacy shared binding." Something like groovy.forin.per.iteration.capture would be self-describing.

…n.capture

Make the language-compat switch self-describing: it only affects for-in
loops, and true means per-iteration capture (false is legacy shared binding).
@sonarqubecloud

Copy link
Copy Markdown

@testlens-app

testlens-app Bot commented Jul 26, 2026

Copy link
Copy Markdown

✅ All tests passed ✅

🏷️ Commit: 1d013d9
▶️ Tests: 107008 executed
⚪️ Checks: 31/31 completed


Learn more about TestLens at testlens.app.

@daniellansun
daniellansun merged commit 19db4fd into master Jul 26, 2026
34 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants