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 2019/07/22 04:22:02 UTC
[jira] [Closed] (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 ]
Paul King closed GROOVY-9153.
-----------------------------
> 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
> Assignee: Daniel Sun
> 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.14#76016)