Details
-
Bug
-
Status: Closed
-
Major
-
Resolution: Fixed
-
4.0.0-alpha-1, 3.0.5, 2.5.14
-
None
-
None
-
Java version AdoptOpenJDK (build 25.262-b10, mixed mode)
Gradle version 6.6.1
Groovy version 3.0.5
Description
java.lang.VerifyError instantiating a concrete class if superclass has static and non-static overloading methods.
superclass:
package bar import groovy.transform.CompileStatic @CompileStatic abstract class SuperProblem { static void fun(Integer i) {} protected void fun(String s) {} }
concrete class:
package foo import bar.SuperProblem import groovy.transform.CompileStatic @CompileStatic class Problem extends SuperProblem { protected void doit() { fun('') } }
harness:
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!!!') } }
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,
./gradlew run
produces this error:
% ./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)