Skip to content

GROOVY-9530: use parsed static field value for constant inlining#2201

Merged
eric-milles merged 2 commits into
masterfrom
GROOVY-9530
Apr 24, 2025
Merged

GROOVY-9530: use parsed static field value for constant inlining#2201
eric-milles merged 2 commits into
masterfrom
GROOVY-9530

Conversation

@eric-milles
Copy link
Copy Markdown
Member

@eric-milles eric-milles commented Apr 19, 2025

Step 1: use field value if given by class decompiler
Step 2: move load field value from transformInlineConstants to configureClassNode -- ClassNode(Class) drives the latter for things like ClassNode CLOSURE_TYPE = ClassHelper.makeCached(Closure.class)

The field value loading could be limited to fields with a ConstantValue attribute. However this is not available through the Reflection API. Maybe it will be available in a JVM newer than 21. In any case, fewer class nodes are created through this path than the wide open constant inlining. So this does address the test case for user code.

@apache apache deleted a comment from codecov-commenter Apr 21, 2025
@eric-milles eric-milles requested a review from paulk-asert April 22, 2025 18:02
@eric-milles eric-milles merged commit 8f6b192 into master Apr 24, 2025
41 checks passed
@eric-milles eric-milles deleted the GROOVY-9530 branch April 24, 2025 14:13
@codecov-commenter
Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 75.00000% with 5 lines in your changes missing coverage. Please review.
✅ Project coverage is 69.2637%. Comparing base (6302c23) to head (6348165).
⚠️ Report is 521 commits behind head on master.

Files with missing lines Patch % Lines
...a/org/apache/groovy/ast/tools/ExpressionUtils.java 63.6364% 0 Missing and 4 partials ⚠️
...in/java/org/codehaus/groovy/vmplugin/v8/Java8.java 87.5000% 1 Missing ⚠️
Additional details and impacted files

Impacted file tree graph

@@                Coverage Diff                 @@
##               master      #2201        +/-   ##
==================================================
+ Coverage     68.9406%   69.2637%   +0.3231%     
- Complexity      29550      30990      +1440     
==================================================
  Files            1423       1423                
  Lines          113901     115209      +1308     
  Branches        19753      20478       +725     
==================================================
+ Hits            78524      79798      +1274     
- Misses          28775      28830        +55     
+ Partials         6602       6581        -21     
Files with missing lines Coverage Δ
...s/groovy/ast/decompiled/MemberSignatureParser.java 97.1014% <100.0000%> (ø)
...in/java/org/codehaus/groovy/vmplugin/v8/Java8.java 78.3862% <87.5000%> (+0.1509%) ⬆️
...a/org/apache/groovy/ast/tools/ExpressionUtils.java 78.0220% <63.6364%> (-0.0529%) ⬇️

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

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