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/05/30 19:08:00 UTC

[jira] [Updated] (GROOVY-9153) StaticInvocationWriter modifies shared global node ConstantExpression.NULL

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

Eric Milles updated GROOVY-9153:
--------------------------------
    Issue Type: Bug  (was: Documentation)

> StaticInvocationWriter modifies shared global node ConstantExpression.NULL
> --------------------------------------------------------------------------
>
>                 Key: GROOVY-9153
>                 URL: https://issues.apache.org/jira/browse/GROOVY-9153
>             Project: Groovy
>          Issue Type: Bug
>            Reporter: Eric Milles
>            Priority: Major
>
> In the case of a static groovy method call like {{File.createTempDir()}}, {{StaticInvocationWriter}}'s {{writeDirectMethodCall}} and {{loadArguments}} mutate the shared global constant node {{ConstantExpression.NULL}}.
> Relevant bits:
> {code:java}
>     protected boolean writeDirectMethodCall(final MethodNode target, final boolean implicitThis, final Expression receiver, final TupleExpression args) {
>         ...
>         if (target instanceof ExtensionMethodNode) {
>             ...
>             if (emn.isStaticExtension()) {
>                 // it's a static extension method
>                 argumentList.add(0, ConstantExpression.NULL);
>             } else {
>                 ....
>             }
>             Parameter[] parameters = node.getParameters();
>             loadArguments(argumentList, parameters);
> ...
>     protected void loadArguments(List<Expression> argumentList, Parameter[] para) {
>         ...
>                 // This is repeated 3 times in the method:
>                 Expression expression = argumentList.get(i);
>                 expression.putNodeMetaData(PARAMETER_TYPE, para[i].getType());
> {code}



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