You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@groovy.apache.org by "ASF GitHub Bot (Jira)" <ji...@apache.org> on 2025/12/22 08:14:00 UTC
[jira] [Commented] (GROOVY-9530) Groovy compiler inlines constants from precompiled classes when it's not safe to do so
[ https://issues.apache.org/jira/browse/GROOVY-9530?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=18046985#comment-18046985 ]
ASF GitHub Bot commented on GROOVY-9530:
----------------------------------------
codecov-commenter commented on PR #2201:
URL: https://github.com/apache/groovy/pull/2201#issuecomment-3680963948
## [Codecov](https://app.codecov.io/gh/apache/groovy/pull/2201?dropdown=coverage&src=pr&el=h1&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) Report
:x: Patch coverage is `75.00000%` with `5 lines` in your changes missing coverage. Please review.
:white_check_mark: Project coverage is 69.2637%. Comparing base ([`6302c23`](https://app.codecov.io/gh/apache/groovy/commit/6302c23b18c917afe099288f8ed969ffabe01d42?dropdown=coverage&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache)) to head ([`6348165`](https://app.codecov.io/gh/apache/groovy/commit/634816577714c725945cb141a035ae5b67a6df4b?dropdown=coverage&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache)).
:warning: Report is 521 commits behind head on master.
| [Files with missing lines](https://app.codecov.io/gh/apache/groovy/pull/2201?dropdown=coverage&src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | Patch % | Lines |
|---|---|---|
| [...a/org/apache/groovy/ast/tools/ExpressionUtils.java](https://app.codecov.io/gh/apache/groovy/pull/2201?src=pr&el=tree&filepath=src%2Fmain%2Fjava%2Forg%2Fapache%2Fgroovy%2Fast%2Ftools%2FExpressionUtils.java&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache#diff-c3JjL21haW4vamF2YS9vcmcvYXBhY2hlL2dyb292eS9hc3QvdG9vbHMvRXhwcmVzc2lvblV0aWxzLmphdmE=) | 63.6364% | [0 Missing and 4 partials :warning: ](https://app.codecov.io/gh/apache/groovy/pull/2201?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) |
| [...in/java/org/codehaus/groovy/vmplugin/v8/Java8.java](https://app.codecov.io/gh/apache/groovy/pull/2201?src=pr&el=tree&filepath=src%2Fmain%2Fjava%2Forg%2Fcodehaus%2Fgroovy%2Fvmplugin%2Fv8%2FJava8.java&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache#diff-c3JjL21haW4vamF2YS9vcmcvY29kZWhhdXMvZ3Jvb3Z5L3ZtcGx1Z2luL3Y4L0phdmE4LmphdmE=) | 87.5000% | [1 Missing :warning: ](https://app.codecov.io/gh/apache/groovy/pull/2201?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) |
<details><summary>Additional details and impacted files</summary>
[](https://app.codecov.io/gh/apache/groovy/pull/2201?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache)
```diff
@@ 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](https://app.codecov.io/gh/apache/groovy/pull/2201?dropdown=coverage&src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | Coverage Δ | |
|---|---|---|
| [...s/groovy/ast/decompiled/MemberSignatureParser.java](https://app.codecov.io/gh/apache/groovy/pull/2201?src=pr&el=tree&filepath=src%2Fmain%2Fjava%2Forg%2Fcodehaus%2Fgroovy%2Fast%2Fdecompiled%2FMemberSignatureParser.java&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache#diff-c3JjL21haW4vamF2YS9vcmcvY29kZWhhdXMvZ3Jvb3Z5L2FzdC9kZWNvbXBpbGVkL01lbWJlclNpZ25hdHVyZVBhcnNlci5qYXZh) | `97.1014% <100.0000%> (ø)` | |
| [...in/java/org/codehaus/groovy/vmplugin/v8/Java8.java](https://app.codecov.io/gh/apache/groovy/pull/2201?src=pr&el=tree&filepath=src%2Fmain%2Fjava%2Forg%2Fcodehaus%2Fgroovy%2Fvmplugin%2Fv8%2FJava8.java&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache#diff-c3JjL21haW4vamF2YS9vcmcvY29kZWhhdXMvZ3Jvb3Z5L3ZtcGx1Z2luL3Y4L0phdmE4LmphdmE=) | `78.3862% <87.5000%> (+0.1509%)` | :arrow_up: |
| [...a/org/apache/groovy/ast/tools/ExpressionUtils.java](https://app.codecov.io/gh/apache/groovy/pull/2201?src=pr&el=tree&filepath=src%2Fmain%2Fjava%2Forg%2Fapache%2Fgroovy%2Fast%2Ftools%2FExpressionUtils.java&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache#diff-c3JjL21haW4vamF2YS9vcmcvYXBhY2hlL2dyb292eS9hc3QvdG9vbHMvRXhwcmVzc2lvblV0aWxzLmphdmE=) | `78.0220% <63.6364%> (-0.0529%)` | :arrow_down: |
... and [6 files with indirect coverage changes](https://app.codecov.io/gh/apache/groovy/pull/2201/indirect-changes?src=pr&el=tree-more&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache)
</details>
<details><summary> :rocket: New features to boost your workflow: </summary>
- :snowflake: [Test Analytics](https://docs.codecov.com/docs/test-analytics): Detect flaky tests, report on failures, and find test suite problems.
- :package: [JS Bundle Analysis](https://docs.codecov.com/docs/javascript-bundle-analysis): Save yourself from yourself by tracking and limiting bundle sizes in JS merges.
</details>
> Groovy compiler inlines constants from precompiled classes when it's not safe to do so
> --------------------------------------------------------------------------------------
>
> Key: GROOVY-9530
> URL: https://issues.apache.org/jira/browse/GROOVY-9530
> Project: Groovy
> Issue Type: Bug
> Components: Compiler
> Affects Versions: 3.0.3, 2.5.11
> Reporter: Marcin Erdmann
> Assignee: Eric Milles
> Priority: Major
> Fix For: 5.0.0-beta-1
>
>
> When a constant (a {{static final}} field) from a precompiled class (a class which is on compilation classpath) is referenced from a declaration of a {{static final}} field in a class which is being compiled the compiler will load and initialise the precompiled class during compilation and inline the value of the referenced constant even if it is not safe to do so, like for example if the value of the constant depends on the contents of the classpath at runtime.
> The issue does not happen in Groovy 2.4.19 but happens in 2.5.11 and 3.0.3
> The following project exposes the issue: https://github.com/erdi/groovy-constant-inlining-bug. If you run {{./gradlew :test}} which uses Groovy 2.4.19 it will pass but it will fail if you run {{./gradlew :testGroovy2_5}} or {{./gradlew testGroovy3_0}}.
> I believe the problem lies in {{org.apache.groovy.ast.tools.ExpressionUtils#transformInlineConstants(org.codehaus.groovy.ast.expr.Expression, org.codehaus.groovy.ast.ClassNode)}} when handling property expressions on non primary class nodes.
--
This message was sent by Atlassian Jira
(v8.20.10#820010)