[
https://issues.apache.org/jira/browse/GROOVY-6277?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Eric Milles updated GROOVY-6277:
--------------------------------
Description:
{code:Java}
class Foo { private getX() {1}}
class Bar extends Foo {public x=2}
@groovy.transform.CompileStatic
def foo() {
return new Bar().x
}
assert foo()==2
{code}
The above example fails at compile time because existsProperty first looks for
a getter and finds the private one in Foo. This getter is inaccessible from
foo() even in normal Groovy, and should have been ignored instead. If it had
been ignored existsProperty might have found Bar#x as a better fit instead
was:
{code:Java}
class Foo { private getX() {1}}
class Bar extends Foo {public x=2}
@groovy.transform.CompileStatic
def foo() {
return new Bar().x
}
assert foo()==2
{code}
The above example fails at compile time because existsProperty first looks for
a getter and finds th private one in Foo. This getter is inaccessible from
foo() even in normal Groovy, and should have been ignored instead. If it had
been ignored existsProperty might have found Bar#x as a better fit instead
> super class private members are preferred over public members of the current
> class with lower priority
> ------------------------------------------------------------------------------------------------------
>
> Key: GROOVY-6277
> URL: https://issues.apache.org/jira/browse/GROOVY-6277
> Project: Groovy
> Issue Type: Bug
> Components: Static compilation
> Affects Versions: 2.1.6, 2.2.0-beta-1, 2.3.0, 2.4.0-rc-1
> Reporter: Jochen Theodorou
> Assignee: Eric Milles
> Priority: Major
> Fix For: 5.0.0-alpha-1
>
>
> {code:Java}
> class Foo { private getX() {1}}
> class Bar extends Foo {public x=2}
> @groovy.transform.CompileStatic
> def foo() {
> return new Bar().x
> }
> assert foo()==2
> {code}
> The above example fails at compile time because existsProperty first looks
> for a getter and finds the private one in Foo. This getter is inaccessible
> from foo() even in normal Groovy, and should have been ignored instead. If it
> had been ignored existsProperty might have found Bar#x as a better fit instead
--
This message was sent by Atlassian Jira
(v8.20.10#820010)