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:14:00 UTC

[jira] [Created] (GROOVY-9615) ScriptBytecodeAdapter.invokeMethodOnSuper can trigger method on this in case of missing method

Eric Milles created GROOVY-9615:
-----------------------------------

             Summary: ScriptBytecodeAdapter.invokeMethodOnSuper can trigger method on this 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.5.12, 3.0.4, 2.4.19
            Reporter: Eric Milles
            Assignee: Eric Milles


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)