GROOVY-9530: use parsed static field value for constant inlining#2201
Merged
Conversation
Codecov Report❌ Patch coverage is Additional details and impacted files@@ 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
🚀 New features to boost your workflow:
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Step 1: use field value if given by class decompiler
Step 2: move load field value from
transformInlineConstantstoconfigureClassNode--ClassNode(Class)drives the latter for things likeClassNode CLOSURE_TYPE = ClassHelper.makeCached(Closure.class)The field value loading could be limited to fields with a
ConstantValueattribute. 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.