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 2020/01/27 10:55:00 UTC

[jira] [Updated] (GROOVY-6898) Changes to metaclasses should not leak into subsequent script executions

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

Paul King updated GROOVY-6898:
------------------------------
    Fix Version/s:     (was: 3.x)
                   4.x

> Changes to metaclasses should not leak into subsequent script executions
> ------------------------------------------------------------------------
>
>                 Key: GROOVY-6898
>                 URL: https://issues.apache.org/jira/browse/GROOVY-6898
>             Project: Groovy
>          Issue Type: Improvement
>    Affects Versions: 2.3.2
>            Reporter: Jochen Kemnade
>            Priority: Major
>             Fix For: 4.x
>
>
> This is roughly related to GROOVY-5786.
> When executing a script in the Groovy ScriptEngine (the JSR223 one) and that script makes changes to the metaclass registry, the modification will be available to the next script.
> For example, If I execute
> {code}
> String.metaClass {
>   foobar ={ 
>     delegate
>   }
> }
> print("Hello".foobar())
> {code}
> the script prints {{"Hello"}}.
> If I execute
> {code}
> print("Hello".foobar())
> {code}
> in the same engine again, it prints {{"Hello"}} again. I think it should throw a {{MissingMethodException}}.



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