[ https://issues.apache.org/jira/browse/GROOVY-7973?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Paul King resolved GROOVY-7973. ------------------------------- Resolution: Fixed Fix Version/s: 2.4.8 Proposed PR merged. > 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 > Assignee: Paul King > Fix For: 2.4.8 > > > There is an incorrect calculation of a qualified 'this' within a closure > within an inner class: > {code} > //@groovy.transform.CompileStatic > class Test { > def op1() { this } > def op2() { ''.with{ this } } > def op3() { new Object() { def inner() { this } } } > def op4() { new Object() { def inner() { ''.with{ this } } } } > def op5() { new Object() { def inner() { Test.this } } } > def op6() { new Object() { def inner() { ''.with{ Test.this } } } } > class Inner { > def inner1() { this } > def inner2() { ''.with { this } } > def inner3() { Test.this } > def inner4() { ''.with { Test.this } } > } > } > def t = new Test() > assert t.op1().class.name == 'Test' > assert t.op2().class.name == 'Test' > assert t.op3().inner().class.name == 'Test$1' > assert t.op4().inner().class.name == 'Test$2' > assert t.op5().inner().class.name == 'Test' > assert t.op6().inner().class.name == 'Test$4$_inner_closure1' // Current > //assert t.op6().inner().class.name == 'Test' // Expected > def inner = new Test.Inner(t) > assert inner.inner1().class.name == 'Test$Inner' > assert inner.inner2().class.name == 'Test$Inner' > assert inner.inner3().class.name == 'Test' > assert inner.inner4().class.name == 'Test$Inner$_inner4_closure2' // Current > // assert inner.inner4().class.name == 'Test' // Expected > {code} -- This message was sent by Atlassian JIRA (v6.3.4#6332)