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 2018/01/11 17:51:00 UTC
[jira] [Commented] (GROOVY-8442) java.lang.VerifyError: Bad
method call from inside of a branch
[ https://issues.apache.org/jira/browse/GROOVY-8442?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16322656#comment-16322656 ]
Jochen Theodorou commented on GROOVY-8442:
------------------------------------------
(1) with static compilation this example should not compile,because createCat is not static
(2) in normal Groovy we may not be able to find the createCat method, but then I expect here a GrooyRuntimeException, not VerifyError
(3)it would be good to knoe the JVM version
> 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)