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

MethodCallExpression.transformExpression does not copy generic types

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Minor
    • Resolution: Fixed
    • 2.4.7
    • 2.4.8
    • ast builder
    • 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

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

              Dates

                Created:
                Updated:
                Resolved: