Details
-
Type:
Bug
-
Status:
Closed
-
Priority:
Minor
-
Resolution: Fixed
-
Affects Version/s: 1.5.7, 1.6-beta-2
-
Fix Version/s: 1.6.3, 1.7-beta-1
-
Component/s: bytecode
-
Labels:None
Description
This script runs fine:
class MyClosure extends Closure { MyClosure(owner) { super(owner) } void run() { println 'running' } } new MyClosure(this).run()
But when I run this script:
class MyClosure extends Closure { MyClosure() { super(this) } void run() { println 'running' } } new MyClosure().run()
I receive:
java.lang.VerifyError: (class: MyClosure, method: <init> signature: ()V) Expecting to find object/array on stack
Perhaps accessing the this variable inside the class definintion isn't supported by current scoping rules but in any case we should get a nice error not VerifyError.
that is strange... I thought we already have a check for the usage of "this" in a case like above... yes,
GROOVY-500sounds very much like that bug... hmm. let me look at Verifier... in fact line 392 is expected to report this as an compilation error. .. but when I look at this code now, I have the feeling this nether really worked right, because the code looks as if it has some obvious bugs.GROOVY-500sounds very much like that bug... hmm. let me look at Verifier... in fact line 392 is expected to report this as an compilation error. .. but when I look at this code now, I have the feeling this nether really worked right, because the code looks as if it has some obvious bugs.