groovy-notifications mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "ASF GitHub Bot (JIRA)" <>
Subject [jira] [Commented] (GROOVY-7951) MethodCallExpression.transformExpression does not copy generic types
Date Fri, 07 Oct 2016 14:48:20 GMT


ASF GitHub Bot commented on GROOVY-7951:

GitHub user jwagenleitner opened a pull request:

    GROOVY-7951: MethodCallExpression.transformExpression does not copy generic types

    PR created from patch supplied in [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 GROOVY-7951

Alternatively you can review and apply these changes as the patch at:

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 <>
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:
>             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),
>         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

View raw message