You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@groovy.apache.org by "Paul King (JIRA)" <ji...@apache.org> on 2016/10/24 13:17:58 UTC

[jira] [Updated] (GROOVY-7973) Class.this not evaluated correctly within a closure within an inner class

     [ https://issues.apache.org/jira/browse/GROOVY-7973?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Paul King updated GROOVY-7973:
------------------------------
    Description: 
There is an incorrect calculation of 'this' within a closure within an inner class (an AIC is shown but a normal inner class exhibits the same behavior):
{code}
class Test {
  def foo() { println this }
  def bar() { new Object() { def inner() { println Test.this } } }
  def baz() { new Object() { def inner() { ''.with{ println Test.this } } } }
}

def t = new Test()
t.foo()          // Test@8bcf778
t.bar().inner()  // Test@8bcf778
t.baz().inner()  // Test$2$_inner_closure1@20c708ba
{code}

  was:
There is an incorrect calculation of 'this' within a closure within a nested class (an AIC is shown but a normal inner class exhibits the same behavior):
{code}
class Test {
  def foo() { println this }
  def bar() { new Object() { def inner() { println Test.this } } }
  def baz() { new Object() { def inner() { ''.with{ println Test.this } } } }
}

def t = new Test()
t.foo()          // Test@8bcf778
t.bar().inner()  // Test@8bcf778
t.baz().inner()  // Test$2$_inner_closure1@20c708ba
{code}


> Class.this not evaluated correctly within a closure within an inner class
> -------------------------------------------------------------------------
>
>                 Key: GROOVY-7973
>                 URL: https://issues.apache.org/jira/browse/GROOVY-7973
>             Project: Groovy
>          Issue Type: Bug
>            Reporter: Paul King
>
> There is an incorrect calculation of 'this' within a closure within an inner class (an AIC is shown but a normal inner class exhibits the same behavior):
> {code}
> class Test {
>   def foo() { println this }
>   def bar() { new Object() { def inner() { println Test.this } } }
>   def baz() { new Object() { def inner() { ''.with{ println Test.this } } } }
> }
> def t = new Test()
> t.foo()          // Test@8bcf778
> t.bar().inner()  // Test@8bcf778
> t.baz().inner()  // Test$2$_inner_closure1@20c708ba
> {code}



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)