You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@groovy.apache.org by "Daniel Sun (JIRA)" <ji...@apache.org> on 2019/06/04 06:16:00 UTC

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

    [ https://issues.apache.org/jira/browse/GROOVY-9153?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16855367#comment-16855367 ] 

Daniel Sun commented on GROOVY-9153:
------------------------------------

The proposed PR was merged into master and will be merged into 2_5_X later.

> 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
>             Fix For: 2.5.8, 3.0.0-beta-2
>
>         Attachments: ConstantExpression.java
>
>          Time Spent: 0.5h
>  Remaining Estimate: 0h
>
> In the case of a static groovy method call like {{File.createTempDir()}} when {{@CompileStatic}} is applied, {{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)