Skip to content

GROOVY-11967: VerifyError in @CompileStatic constructor with default-…#2493

Open
paulk-asert wants to merge 1 commit intoapache:masterfrom
paulk-asert:groovy11967
Open

GROOVY-11967: VerifyError in @CompileStatic constructor with default-…#2493
paulk-asert wants to merge 1 commit intoapache:masterfrom
paulk-asert:groovy11967

Conversation

@paulk-asert
Copy link
Copy Markdown
Contributor

@paulk-asert paulk-asert commented Apr 26, 2026

@codecov-commenter
Copy link
Copy Markdown

codecov-commenter commented Apr 26, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 67.1663%. Comparing base (7c36803) to head (c40387e).

Additional details and impacted files

Impacted file tree graph

@@                Coverage Diff                 @@
##               master      #2493        +/-   ##
==================================================
+ Coverage     67.1394%   67.1663%   +0.0269%     
- Complexity      31627      31641        +14     
==================================================
  Files            1451       1451                
  Lines          122560     122563         +3     
  Branches        22007      22008         +1     
==================================================
+ Hits            82286      82321        +35     
+ Misses          33194      33158        -36     
- Partials         7080       7084         +4     
Files with missing lines Coverage Δ
...orm/sc/transformers/ListExpressionTransformer.java 97.9167% <100.0000%> (+0.1389%) ⬆️

... and 7 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.

Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Adds regression coverage and a bytecode-generation fix for GROOVY-11967, addressing a JVM verifier failure triggered by @CompileStatic constructors with default-valued list parameters when bridge constructors are generated.

Changes:

  • Add a new JUnit regression test suite covering several default-list constructor parameter shapes (class, string, integer, nested, empty, and mid-parameter defaults).
  • Adjust static compilation list-literal bytecode emission to insert a CHECKCAST before ArrayList.add in indy scenarios to satisfy the verifier.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 3 comments.

File Description
src/test/groovy/bugs/Groovy11967.groovy New regression tests reproducing and guarding the VerifyError scenario across multiple default-list cases.
src/main/java/org/codehaus/groovy/transform/sc/transformers/ListExpressionTransformer.java Bytecode emission tweak to cast the list instance before invoking ArrayList.add when constructor calls leave Object on stack in indy mode.

Comment thread src/test/groovy/bugs/Groovy11967.groovy Outdated
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.

3 participants