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 2022/05/26 20:01:00 UTC
[jira] [Updated] (GROOVY-10637) SC: implicit-this reference to outer class super property produces access error
[ https://issues.apache.org/jira/browse/GROOVY-10637?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Eric Milles updated GROOVY-10637:
---------------------------------
Description:
Consider the following:
{code:java}
public class JavaBean<T> {
private T value;
public T getValue() {
return value;
}
public void setValue(T value) {
this.value = value;
}
}
{code}
{code:groovy}
@groovy.transform.CompileStatic
class Outer extends groovy.transform.stc.JavaBean<Inner> {
static class Inner {
String string
}
def bar() {
{ -> value.string }.call() // "value" is parameterized property
}
}
def foo = new Outer(value: new Outer.Inner(string:'hello world'))
assert foo.bar() == 'hello world'
{code}
"Access to T#string is forbidden"
was:
Consider the following:
{code:java}
public class JavaBean<T> {
private T value;
public T getValue() {
return value;
}
public void setValue(T value) {
this.value = value;
}
}
{code}
{code:groovy}
class Outer extends groovy.transform.stc.JavaBean<Inner> {
static class Inner {
String string
}
def bar() {
{ -> value.string }.call() // "value" is parameterized property
}
}
def foo = new Outer(value: new Outer.Inner(string:'hello world'))
assert foo.bar() == 'hello world'
{code}
"Access to T#string is forbidden"
> SC: implicit-this reference to outer class super property produces access error
> -------------------------------------------------------------------------------
>
> Key: GROOVY-10637
> URL: https://issues.apache.org/jira/browse/GROOVY-10637
> Project: Groovy
> Issue Type: Bug
> Components: Static compilation
> Affects Versions: 4.0.2
> Reporter: Eric Milles
> Assignee: Eric Milles
> Priority: Major
>
> Consider the following:
> {code:java}
> public class JavaBean<T> {
> private T value;
> public T getValue() {
> return value;
> }
> public void setValue(T value) {
> this.value = value;
> }
> }
> {code}
> {code:groovy}
> @groovy.transform.CompileStatic
> class Outer extends groovy.transform.stc.JavaBean<Inner> {
> static class Inner {
> String string
> }
> def bar() {
> { -> value.string }.call() // "value" is parameterized property
> }
> }
> def foo = new Outer(value: new Outer.Inner(string:'hello world'))
> assert foo.bar() == 'hello world'
> {code}
> "Access to T#string is forbidden"
--
This message was sent by Atlassian Jira
(v8.20.7#820007)