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

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

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

Eric Milles updated GROOVY-9000:
--------------------------------
    Affects Version/s: 2.4.16

> 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
>    Affects Versions: 2.4.16
>            Reporter: Eric Milles
>            Priority: Major
>
> 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)