You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@groovy.apache.org by "Octavia Togami (Jira)" <ji...@apache.org> on 2025/04/22 00:15:00 UTC
[jira] [Commented] (GROOVY-11568) Call to private method fails when using Custom MetaClass
[ https://issues.apache.org/jira/browse/GROOVY-11568?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17946262#comment-17946262 ]
Octavia Togami commented on GROOVY-11568:
-----------------------------------------
Can this be backported to 4.x? I believe it affects Gradle & plugins as we make heavy use of custom metaclasses, e.g. with https://github.com/gradle/gradle/issues/32476 or https://github.com/nebula-plugins/gradle-lint-plugin/issues/417.
> Call to private method fails when using Custom MetaClass
> --------------------------------------------------------
>
> Key: GROOVY-11568
> URL: https://issues.apache.org/jira/browse/GROOVY-11568
> Project: Groovy
> Issue Type: Bug
> Affects Versions: 4.0.25, 3.0.24
> Reporter: Andreas Turban
> Assignee: Eric Milles
> Priority: Major
> Fix For: 5.0.0-alpha-13
>
> Attachments: test.groovy
>
>
> A call to a private method in a BaseClass fails, if the MetaClass of an instance of a SubType is replace with a non-standard MetaClass.
> The attached reproducer should call the method privateMethod(), but does fail with:
> {code:java}
> groovy.lang.MissingMethodException: No signature of method: SubClass.privateMethod() is applicable for argument types: () values: []
> at CustomMetaClass.invokeMethod(test.groovy:40)
> at CustomMetaClass.super$2$invokeMethod(test.groovy)
> at CustomMetaClass.invokeMethod(test.groovy:30)
> at BaseClass.publicMethod(test.groovy:10)
> at CustomMetaClass.super$2$invokeMethod(test.groovy)
> at CustomMetaClass.invokeMethod(test.groovy:40)
> at CustomMetaClass.super$2$invokeMethod(test.groovy)
> at CustomMetaClass.invokeMethod(test.groovy:35)
> at test.run(test.groovy:5)
> {code}
> See also [Groovy WebConsole|https://gwc-experiment.appspot.com/?g=groovy_4_0&codez=eNq1U8tOwzAQvOcrVj0lUpQfqJCACqEeoBLlhjg4yZIYHLtaOyml6r9j5-GkrUAghA9xNDuenV2vgxxfIIMLkLiFdZ0uBNM6jAIHV2hYH1nU2qjqzgId4ZaUanbrnTZYJQUaH3nAgmtDuzCKvVwUOKWES244E_wDrX6W6Mmp0BEcuKlTwTOLlyq3rCDIXBiumcaWCPsA7GoUz-GY2wXc2hBvmEEv4rBD-w0m4V7jmDuKmJLUti39hkhROFuXqhY5lKxBSBElZEwIzJPZkOAwmB3KBnw3KPOJ-73nnPTTUz2yrDbCFttqnzb_rNlA_U8MnZwpu4QRjBXpeoMUjkzPmfcFtNvlqkEinmN3bpW-YmaAy0a9DV3qMdVu9pYNcVm4YbHBe1ZhPJxiVNQVSnNkg9DUJDs3yZHuIDhVGiX-y-XTMyjiBZdMXP3d77nUb313F6jtNCD5Tv6kCt-qGFKlBDIJXC_skD6qtTM_wi-kqqXU1sbZkHxd7eDo21uKT1OeppqPj-UTDs1_GA].
> It also seams to need to be compiled with Indy, but with Indy it fails in Groovy 3.x and Groovy 4.x.
> The culprit seams somewhere around "org.codehaus.groovy.vmplugin.v8.Selector.getMetaClassImpl()" where the type of the meta class is checked, and for non standard MetaClass the code path deviates.
> And then the Sender Class "BaseClass" is not used in the CustomMetaClass anymore, then failing with it could not find the private method.
> Note: It does not fail, if the class is not compile with Indy.
--
This message was sent by Atlassian Jira
(v8.20.10#820010)