[
https://issues.apache.org/jira/browse/GROOVY-11412?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Eric Milles updated GROOVY-11412:
---------------------------------
Description:
The test case described in GROOVY-10985 fails to execute as expected under
static compilation if a single reference to the private outer class field is
introduced.
{code:groovy}
@groovy.transform.CompileStatic
class Outer {
private static int VALUE = 1
class Inner { // adding static stops use of bridge method
def getProperty(String name) {
if (name == "VALUE") return 2
}
void test() {
if (Outer.VALUE > 0) print 'positive' // creates private access bridge
print VALUE // classgen now targets private access bridge
}
}
void test() {
new Inner().test()
}
}
new Outer().test()
{code}
was:
The test case described in GROOVY-10985 fails to execute as expected under
static compilation if a single reference to the private outer class field is
introduced.
{code:groovy}
@groovy.transform.CompileStatic
class Outer {
private static int VALUE = 1
static class Inner {
def getProperty(String name) {
if (name == "VALUE") return 2
}
void test() {
if (Outer.VALUE > 0) print 'positive' // creates private access bridge
print VALUE // classgen now targets private access bridge
}
}
}
new Outer.Inner().test()
{code}
> SC: outer class field and self dynamic property
> -----------------------------------------------
>
> Key: GROOVY-11412
> URL: https://issues.apache.org/jira/browse/GROOVY-11412
> Project: Groovy
> Issue Type: Bug
> Components: Static compilation
> Affects Versions: 5.0.0-alpha-8
> Reporter: Eric Milles
> Assignee: Eric Milles
> Priority: Major
>
> The test case described in GROOVY-10985 fails to execute as expected under
> static compilation if a single reference to the private outer class field is
> introduced.
> {code:groovy}
> @groovy.transform.CompileStatic
> class Outer {
> private static int VALUE = 1
> class Inner { // adding static stops use of bridge method
> def getProperty(String name) {
> if (name == "VALUE") return 2
> }
> void test() {
> if (Outer.VALUE > 0) print 'positive' // creates private access bridge
> print VALUE // classgen now targets private access bridge
> }
> }
> void test() {
> new Inner().test()
> }
> }
> new Outer().test()
> {code}
--
This message was sent by Atlassian Jira
(v8.20.10#820010)