[jira] [Assigned] (GROOVY-7020) Problem With "this" Inside Of Anonymous Inner Class

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

[jira] [Assigned] (GROOVY-7020) Problem With "this" Inside Of Anonymous Inner Class

Eric Milles (Jira)

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

Eric Milles reassigned GROOVY-7020:
-----------------------------------

    Assignee: Eric Milles

> Problem With "this" Inside Of Anonymous Inner Class
> ---------------------------------------------------
>
>                 Key: GROOVY-7020
>                 URL: https://issues.apache.org/jira/browse/GROOVY-7020
>             Project: Groovy
>          Issue Type: Bug
>    Affects Versions: 2.3.3, 2.4.1
>            Reporter: Jeff Brown
>            Assignee: Eric Milles
>            Priority: Major
>
> If an anonymous inner class is defined inside of a static method, "this" does not reference what it should:
> {code:title=Demo.groovy|borderStyle=solid}
> class Demo {
>     static void main(arg) {
>         def r = new Runnable() {
>             void run() {
>                 if(this instanceof Runnable) {
>                     println 'Yep'
>                 } else {
>                     println 'Nope'
>                 }
>             }
>         }
>         r.run()
>     }
> }
> {code}
> {noformat}
> $ groovy Demo
> Nope
> {noformat}
> 2.3.3 is the only version I have tested this with.



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