[ https://issues.apache.org/jira/browse/GROOVY-10191?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Eric Milles updated GROOVY-10191: --------------------------------- Affects Version/s: 2.5.14 3.0.8 4.0.0-alpha-3 > NoSuchMethodError during static field inlining is not caught, unlike > NoSuchFieldException > ----------------------------------------------------------------------------------------- > > Key: GROOVY-10191 > URL: https://issues.apache.org/jira/browse/GROOVY-10191 > Project: Groovy > Issue Type: Bug > Affects Versions: 2.5.14, 3.0.8, 4.0.0-alpha-3 > Reporter: Eric Milles > Assignee: Eric Milles > Priority: Major > > This is a bit hard to reproduce. We have a situation something like this: > {code:groovy} > class Main { > private static final x = Type.CONST > } > {code} > Then, this is defined in a separate project or jar: > {code:groovy} > class Type { > public static final CONST = 'value' > static { > // some other class initialization that is failing due to classpath > ordering > } > } > {code} > When {{Verifier}} tries to inline the initial value for {{x}}, > {{ExpressionUtils}} falls into the non-primary type path ({{Type}} is in > separate project or jar). We had a situation where we had two versions of a > 3rd-party library on the classpath and it ended up throwing > {{NoSuchMethodError}} when the lower version was picked up. This can be > simulated by adding {{throw new NoSuchMethodError()}} to the static > initializer of {{Type}}. > https://github.com/apache/groovy/blob/d7684d101d64ca6da28fdb8069ea92475d011168/src/main/java/org/apache/groovy/ast/tools/ExpressionUtils.java#L236 -- This message was sent by Atlassian Jira (v8.3.4#803005)