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 2019/02/18 20:32:00 UTC

[jira] [Created] (GROOVY-9000) Unexpected type for super within non-static inner class

Eric Milles created GROOVY-9000:
-----------------------------------

             Summary: Unexpected type for super within non-static inner class
                 Key: GROOVY-9000
                 URL: https://issues.apache.org/jira/browse/GROOVY-9000
             Project: Groovy
          Issue Type: Bug
            Reporter: Eric Milles


Consider the following:

{code:groovy}
class Foo {
  class Bar {
    def baz() {
      super
    }
  }
}
{code}

If I create an instance of Bar and call baz(), I receive the instance of Bar as the return value.  That is "super" in this context maps to the inner class itself.  This causes "super.whatever" to work like "this.whatever" or implicit-this "whatever", which is unexpected.  For example, I was able to call a private method of Foo using "super.method()" when I would expect method missing instead.



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)