You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@groovy.apache.org by "Jochen Theodorou (JIRA)" <ji...@apache.org> on 2017/02/13 15:10:42 UTC
[jira] [Commented] (GROOVY-6809) VerifyError With Inner Class
[ https://issues.apache.org/jira/browse/GROOVY-6809?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15863799#comment-15863799 ]
Jochen Theodorou commented on GROOVY-6809:
------------------------------------------
I think the base issue is a not set static context, or that fact being ignored. Related example:
{code:Java}
class A {A(x){}}
class B extends A {
B(){
super (new Object() {})
}
}
new B()
{code}
fails with a VerifyError, because the compiler tries to use "this" for the anonymous inner class in the super call. But at this time, there is no initialized "this". But unlike A.this in a previous comment, which I think should fail, the code example in this comment is supposed to work by just not using the "this"-context... in at least in a static compiler any call to outside "this" from the inner class is supposed to cause a compilation error as well.
> VerifyError With Inner Class
> -----------------------------
>
> Key: GROOVY-6809
> URL: https://issues.apache.org/jira/browse/GROOVY-6809
> Project: Groovy
> Issue Type: Bug
> Components: Compiler
> Affects Versions: 2.3.0, 2.4.0-beta-3
> Reporter: Jeff Brown
>
> The following code compiles but throws a VerifyError at runtime:
> {code:title=Test.groovy|borderStyle=solid}
> class Test {
> static void main(String[] args) {
> def a = new A()
> }
> static class A {
> A() {
> def b = new B()
> }
> void sayA() { println 'saying A' }
> class B extends A {
> public B() {
> super(A.this)
> sayA()
> }
> }
> }
> }
> {code}
> I didn't go back through versions but I tested with 2.3.0 and that shows the problem.
> {noformat}
> Caught: java.lang.VerifyError: (class: Test$A$B, method: <init> signature: (LTest$A;)V) Expecting to find object/array on stack
> java.lang.VerifyError: (class: Test$A$B, method: <init> signature: (LTest$A;)V) Expecting to find object/array on stack
> at Test$A.<init>(Test.groovy:9)
> at Test.main(Test.groovy:4)
> {noformat}
--
This message was sent by Atlassian JIRA
(v6.3.15#6346)