Details
-
Bug
-
Status: Closed
-
Major
-
Resolution: Fixed
-
2.4.9
-
None
Description
given this base class
abstract class AnimalBuilder { def animal; AnimalBuilder(def animal) { this.animal = animal } }
This subclass works as expected
class CatBuilder extends AnimalBuilder { CatBuilder() { super(new Cat()); } }
but this
class CatBuilder2 extends AnimalBuilder { CatBuilder2() { super(createCat()); } private Cat createCat() { new Cat() } }
Will result an
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
The full example can be seen here https://github.com/szantopeter/groovy-compile-failure2