Scott Murphy Heiberg created GROOVY-12570:
---------------------------------------------

             Summary: super.m() cannot reach a package-private method of a 
superclass defined by another class loader
                 Key: GROOVY-12570
                 URL: https://issues.apache.org/jira/browse/GROOVY-12570
             Project: Groovy
          Issue Type: Bug
          Components: groovy-runtime
    Affects Versions: 6.0.0
            Reporter: Scott Murphy Heiberg


{code:groovy}
def shell = new GroovyShell()
shell.evaluate '''package p
    class M { @groovy.transform.PackageScope String pm() { 'M' } }
    true
'''
shell.evaluate '''package p
    class B extends M { // same package name as M, but another class loader
        String pm() { 'B>' + super.pm() }
    }
    new B().pm()
''' // MissingMethodException; expected 'B>M'
{code}

The JVM does not let {{B.pm()}} override a package-private method of another 
run-time package, so no {{super$}} method can call it, and the meta-class drops 
the method from the methods for super calls without keeping the superclass 
method. The same holds under {{@CompileStatic}}. Expected: {{super.pm()}} calls 
{{M.pm()}}.



--
This message was sent by Atlassian Jira
(v10.3.26#10030026)

Reply via email to