codeconsole opened a new pull request, #3099:
URL: https://github.com/apache/groovy/pull/3099

   A class that declares `m()` and calls `super.m()`, where `m()` is 
package-private in a superclass with the same package name but defined by 
another class loader (for example a class of an earlier parse of the same 
`GroovyShell`), failed with `MissingMethodException`. The JVM does not let the 
subclass method override a package-private method of another run-time package, 
so no `super$` method can call it; without one, the meta-class removed the 
subclass method from the methods for super calls and kept nothing, as the 
superclass method had already been replaced by the subclass method in the index.
   
   The meta-class now keeps the superclass method for super calls in that case. 
Invoked reflectively it is the superclass method, because the JVM does not 
consider it overridden. Super calls that a `super$` method serves, and 
package-private methods of another package, are unchanged.
   
   This needs #3097, which stops generating a `super$` method for a 
package-private method of another run-time package and routes the statically 
compiled call through the meta-class; its commits are included until it is 
merged. It touches the same lines of `MetaClassImpl` as #3048, so whichever is 
merged second needs a rebase.
   
   ## Tests
   
   
`bugs.Groovy12568.testSuperCallOfPackagePrivateMethodOfClassOfAnotherClassLoaderWithMethodOfSameName`
 (marked `// GROOVY-12570`), dynamic and `@CompileStatic`, with and without 
invokedynamic; it fails without the change.
   
   `bugs`, `groovy.ThisAndSuperTest`, `groovy.lang.*` and 
`StaticCompileRuntimePackageTest` pass (1,144 tests), as do the Checkstyle and 
CodeNarc gates.
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to