Details
-
Type:
Bug
-
Status:
Closed
-
Priority:
Major
-
Resolution: Duplicate
-
Affects Version/s: None
-
Fix Version/s: 1.6-rc-1, 1.5.8, 1.7-beta-1
-
Component/s: None
-
Labels:None
-
Testcase included:yes
-
Number of attachments :
Description
testSimilarNamesForMethodAndLocalWithLocalAsMethodArgument fails.
class DelegationTest extends GroovyTestCase { void testSimilarNamesForMethodAndLocalWithLocalAsMethodArgument() { new Executer().failingExecute() } void testSimilarNamesForMethodAndLocalWithNoArgMethod() { new Executer().workingExecute() } } class Executer { void convention(String arg) { println 'called' } void convention() { println 'called' } void failingExecute() { def convention= 'value' 10.times { this.convention(convention) } } void workingExecute() { def convention= 'value' 10.times { this.convention() } } }
Issue Links
- is related to
-
GROOVY-3156
Within a nested closure, "this.method()" works incorrectly if parent closure and outermost class have closures/methods of the same name
-
This bug is internally related to same implementation issue in ACG as identified in
GROOVY-3156. Even this is case of a method call expression explicitly qualified by "this" being made inside a closure when compileStack contains a variable of the same name as the method.The patches supplied with
GROOVY-3156fix this issue as well on versions 1.5.8, 1.6-RC-1, 1.7-beta-1. I have test verified.rgds,
Roshan