[ https://issues.apache.org/jira/browse/GROOVY-9530?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17945872#comment-17945872 ]
ASF GitHub Bot commented on GROOVY-9530: ---------------------------------------- eric-milles opened a new pull request, #2201: URL: https://github.com/apache/groovy/pull/2201 Step 1: use field value if given by class decompiler > 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 > > 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)