You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@groovy.apache.org by "Eric Milles (Jira)" <ji...@apache.org> on 2020/07/03 15:26:00 UTC
[jira] [Commented] (GROOVY-9618) Property reference resolves to
field, not getter when property name is single upper-case letter
[ https://issues.apache.org/jira/browse/GROOVY-9618?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17151032#comment-17151032 ]
Eric Milles commented on GROOVY-9618:
-------------------------------------
Same situation exists for non-static fields and methods. It's just unconventional to name instance fields with an uppercase letter.
> Property reference resolves to field, not getter when property name is single upper-case letter
> -----------------------------------------------------------------------------------------------
>
> Key: GROOVY-9618
> URL: https://issues.apache.org/jira/browse/GROOVY-9618
> Project: Groovy
> Issue Type: Bug
> Affects Versions: 2.4.19, 3.0.4, 2.5.12
> Reporter: Eric Milles
> Assignee: Eric Milles
> Priority: Major
> Time Spent: 20m
> Remaining Estimate: 0h
>
> Consider the following:
> {code:groovy}
> class A {
> private static X = 1
> static getX() { 2 }
> static class B {
> }
> }
> class C extends A.B {
> void test() {
> print X
> }
> }
> new C().test()
> {code}
> Execution of this script prints "1" when "2" is expected. If static property name is changed to "XY" or "x" the resolution works as expected.
--
This message was sent by Atlassian Jira
(v8.3.4#803005)