[
https://issues.apache.org/jira/browse/GROOVY-10985?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17754767#comment-17754767
]
Eric Milles commented on GROOVY-10985:
--------------------------------------
AsmClassGenerator#visitPropertyExpression
{code:java}
// GROOVY-9501, GROOVY-9569, GROOVY-9650, GROOVY-9655,
GROOVY-9665, GROOVY-9683, GROOVY-9695
if (fieldNode == null &&
!isFieldDirectlyAccessible(getField(classNode, name), classNode)) {
if (checkStaticOuterField(expression, name)) return;
}
{code}
> Precedence of self property over outer class field
> --------------------------------------------------
>
> Key: GROOVY-10985
> URL: https://issues.apache.org/jira/browse/GROOVY-10985
> Project: Groovy
> Issue Type: Bug
> Reporter: Eric Milles
> Assignee: Eric Milles
> Priority: Major
>
> Consider the following:
> {code:groovy}
> class Outer {
> private static int VALUE = 1
> static class Inner {
> def getProperty(String name) {
> if (name == "VALUE") return 2
> }
> void test() {
> print VALUE
> }
> }
> }
> new Outer.Inner().test()
> {code}
> Expecting "2" but prints "1". If {{Inner}} provides a "generic" property via
> getProperty, get or via a Map interface it is not used.
--
This message was sent by Atlassian Jira
(v8.20.10#820010)