You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@groovy.apache.org by "Paul King (JIRA)" <ji...@apache.org> on 2017/02/01 23:19:06 UTC

[jira] [Closed] (GROOVY-7925) 'this' and 'super' as LHS of an assignment

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

Paul King closed GROOVY-7925.
-----------------------------

> 'this' and 'super' as LHS of an assignment
> ------------------------------------------
>
>                 Key: GROOVY-7925
>                 URL: https://issues.apache.org/jira/browse/GROOVY-7925
>             Project: Groovy
>          Issue Type: Bug
>            Reporter: Paul King
>            Assignee: Paul King
>             Fix For: 2.4.8
>
>
> The following code runs successfully.
> {code}
> class Foo {
>   static void main(String[] args) {
>     assert "${this.name} ${super.name}" == 'Foo java.lang.Object'
>     super = true
>     this = false
>     assert "${this.name} ${super.name}" == 'Foo java.lang.Object'
>   }
> }
> {code}
> The attempt to change these 'special' variables is ignored but there should be some kind of error. I think it makes sense for this to be a compilation error and it should come late in the compilation phases to allow DSLs to include 'this' or 'super' and transform them into something sensible.



--
This message was sent by Atlassian JIRA
(v6.3.15#6346)