Chiang Seng Chang created GROOVY-9737:
-----------------------------------------

             Summary: Groovy 3.0.5 VerifyError overloading static method in 
superclass
                 Key: GROOVY-9737
                 URL: https://issues.apache.org/jira/browse/GROOVY-9737
             Project: Groovy
          Issue Type: Bug
    Affects Versions: 3.0.5
            Reporter: Chiang Seng Chang
         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)

Reply via email to