You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@groovy.apache.org by "Peter Szanto (JIRA)" <ji...@apache.org> on 2018/01/11 09:02:00 UTC

[jira] [Created] (GROOVY-8442) java.lang.VerifyError: Bad method call from inside of a branch

Peter Szanto created GROOVY-8442:
------------------------------------

             Summary: java.lang.VerifyError: Bad <init> method call from inside of a branch
                 Key: GROOVY-8442
                 URL: https://issues.apache.org/jira/browse/GROOVY-8442
             Project: Groovy
          Issue Type: Bug
          Components: Compiler
    Affects Versions: 2.4.9
            Reporter: Peter Szanto


given this base class

{code}
abstract class AnimalBuilder {

    def animal;

    AnimalBuilder(def animal) {
        this.animal = animal
    }

}
{code}

This subclass works as expected 

{code}
class CatBuilder extends AnimalBuilder {

    CatBuilder() {
        super(new Cat());
    }

}
{code}

but this 

{code}
class CatBuilder2 extends AnimalBuilder {

    CatBuilder2() {
        super(createCat());
    }

    private Cat createCat() {
        new Cat()
    }

}
{code}

Will result an 

{code}
java.lang.VerifyError: Bad <init> method call from inside of a branch
Exception Details:
  Location:
    org/example/builder/CatBuilder2.<init>()V @25: invokespecial
  Reason:
    Error exists in the bytecode
{code}

The full example can be seen here https://github.com/szantopeter/groovy-compile-failure2



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)