Uploaded image for project: 'Groovy'
  1. Groovy
  2. GROOVY-7951

MethodCallExpression.transformExpression does not copy generic types

    XMLWordPrintableJSON

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Minor
    • Resolution: Fixed
    • Affects Version/s: 2.4.7
    • Fix Version/s: 2.4.8
    • Component/s: ast builder
    • Labels:
      None

      Description

      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:

          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;
          }
      

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                jwagenleitner John Wagenleitner
                Reporter:
                emilles Eric Milles
              • Votes:
                0 Vote for this issue
                Watchers:
                5 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: