You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@groovy.apache.org by "Eric Milles (Jira)" <ji...@apache.org> on 2021/01/25 15:22:00 UTC

[jira] [Assigned] (GROOVY-9737) Groovy 3.0.5 VerifyError if superclass has static and non-static overloading methods

     [ https://issues.apache.org/jira/browse/GROOVY-9737?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Eric Milles reassigned GROOVY-9737:
-----------------------------------

    Assignee: Eric Milles

> Groovy 3.0.5 VerifyError if superclass has static and non-static overloading methods
> ------------------------------------------------------------------------------------
>
>                 Key: GROOVY-9737
>                 URL: https://issues.apache.org/jira/browse/GROOVY-9737
>             Project: Groovy
>          Issue Type: Bug
>    Affects Versions: 3.0.5
>         Environment: Java version AdoptOpenJDK (build 25.262-b10, mixed mode)
> Gradle version 6.6.1
> Groovy version 3.0.5 
>            Reporter: Chiang Seng Chang
>            Assignee: Eric Milles
>            Priority: Major
>         Attachments: g3ve.tar.gz
>
>
> java.lang.VerifyError instantiating a concrete class if superclass has static and non-static overloading methods.
> superclass:
> {noformat}
> package bar
> import groovy.transform.CompileStatic
> @CompileStatic
> abstract class SuperProblem {
>     static void fun(Integer i) {}
>     protected void fun(String s) {}
> }
> {noformat}
> concrete class:
> {noformat}
> package foo
> import bar.SuperProblem
> import groovy.transform.CompileStatic
> @CompileStatic
> class Problem extends SuperProblem {
>     protected void doit() {
>         fun('')
>     }
> }
> {noformat}
> harness:
> {noformat}
> package app
> import foo.Problem
> import groovy.transform.CompileStatic
> @CompileStatic
> class Test {
>     static void main(String[] args) {
>         Problem problem = new Problem()
>         println('SHOULD NOT SEE THIS BECAUSE IT MEANS Class Problem HAS NO PROBLEM!!!')
>     }
> }
> {noformat}
>  
>  Observations:
>  # No compilation error.
>  # Superclass must be in a different package.
>  # Groovy 2.5.13 has no such issue.
> I have included the test project,
> {noformat}
> ./gradlew run
> {noformat}
> produces this error:
> {noformat}
> % ./gradlew run
> > Task :run FAILED
> Exception in thread "main" java.lang.VerifyError: Bad access to protected data in invokevirtual
> Exception Details:
>   Location:
>     foo/Problem.doit()V @12: invokevirtual
>   Reason:
>     Type 'bar/SuperProblem' (current frame, stack[0]) is not assignable to 'foo/Problem'
>   Current Frame:
>     bci: @12
>     flags: { }
>     locals: { 'foo/Problem' }
>     stack: { 'bar/SuperProblem', 'java/lang/String' }
>   Bytecode:
>     0x0000000: 1202 1204 b800 17c0 0004 1219 b600 1d01
>     0x0000010: 57b1
>         at app.Test.main(Test.groovy:13)
> {noformat}
>  
>  



--
This message was sent by Atlassian Jira
(v8.3.4#803005)