You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@groovy.apache.org by "ASF GitHub Bot (JIRA)" <ji...@apache.org> on 2016/10/07 14:48:20 UTC
[jira] [Commented] (GROOVY-7951)
MethodCallExpression.transformExpression does not copy generic types
[ https://issues.apache.org/jira/browse/GROOVY-7951?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15555271#comment-15555271 ]
ASF GitHub Bot commented on GROOVY-7951:
----------------------------------------
GitHub user jwagenleitner opened a pull request:
https://github.com/apache/groovy/pull/441
GROOVY-7951: MethodCallExpression.transformExpression does not copy generic types
PR created from patch supplied in [GROOVY-7951](https://issues.apache.org/jira/browse/GROOVY-7951). It seems like a reasonable change to make, though I did have trouble thinking up a way to test it that would be meaningful. If anyone can nudge me in the right direction I can try to write up a test if you think it's warranted in this case.
I considered whether `genericsTypes.clone()` should be used, but it didn't seem to be common and most uses of the array seem to be read only.
You can merge this pull request into a Git repository by running:
$ git pull https://github.com/jwagenleitner/groovy GROOVY-7951
Alternatively you can review and apply these changes as the patch at:
https://github.com/apache/groovy/pull/441.patch
To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:
This closes #441
----
commit 76f9cdabd6e48baf5721b6b6dbff21a109f164a7
Author: John Wagenleitner <jw...@apache.org>
Date: 2016-10-04T22:29:59Z
GROOVY-7951: MethodCallExpression.transformExpression does not copy generic types
----
> MethodCallExpression.transformExpression does not copy generic types
> --------------------------------------------------------------------
>
> Key: GROOVY-7951
> URL: https://issues.apache.org/jira/browse/GROOVY-7951
> Project: Groovy
> Issue Type: Bug
> Components: ast builder
> Affects Versions: 2.4.7
> Reporter: Eric Milles
> Priority: Minor
>
> org.codehaus.groovy.ast.expr.MethodCallExpression.transformExpression(ExpressionTransformer) is not copying generics info. Downstream visitors are unable to check generics on static calls like Collections.<String>emptyList().
> My patched version:
> {code:java}
> public Expression transformExpression(ExpressionTransformer transformer) {
> MethodCallExpression answer =
> new MethodCallExpression(transformer.transform(objectExpression), transformer.transform(method), transformer.transform(arguments));
> answer.setSafe(safe);
> answer.setSpreadSafe(spreadSafe);
> answer.setImplicitThis(implicitThis);
> // GRECLIPSE add
> answer.setGenericsTypes(genericsTypes);
> // GRECLIPSE end
> answer.setMethodTarget(target);
> answer.setSourcePosition(this);
> answer.copyNodeMetaData(this);
> return answer;
> }
> {code}
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)