You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@groovy.apache.org by "Eric Milles (Jira)" <ji...@apache.org> on 2020/07/01 22:19:00 UTC

[jira] [Updated] (GROOVY-9615) super.method() can trigger method on outer class in case of missing method

     [ https://issues.apache.org/jira/browse/GROOVY-9615?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Eric Milles updated GROOVY-9615:
--------------------------------
    Summary: super.method() can trigger method on outer class in case of missing method  (was: super.method() can trigger method on this in case of missing method)

> super.method() can trigger method on outer class in case of missing method
> --------------------------------------------------------------------------
>
>                 Key: GROOVY-9615
>                 URL: https://issues.apache.org/jira/browse/GROOVY-9615
>             Project: Groovy
>          Issue Type: Bug
>    Affects Versions: 2.4.19, 3.0.4, 2.5.12
>            Reporter: Eric Milles
>            Assignee: Eric Milles
>            Priority: Major
>
> Consider the following:
> {code:groovy}
> class Outer {
>     class Inner {
>         void test() {
>             super.whatever()
>         }
>     }
>     void whatever() {
>         assert false : 'should not have been called!'
>     }
> }
> new Outer.Inner(new Outer()).test()
> {code}
> When method in Inner is called, instead of method missing exception, the method on Outer is called.  This is because ScriptBytecodeAdapter.invokeMethodOnSuper triggers MetaClassImpl.invokeMissingMethod, which calls its missingMethod reference regardless of isCallToSuper setting.



--
This message was sent by Atlassian Jira
(v8.3.4#803005)