private void doAddConstructor(final ClassNode cNode, final ConstructorNode constructorNode) {
    cNode.addConstructor(constructorNode);
    // GROOVY-5814: Immutable is not compatible with @CompileStatic
    Parameter argsParam = null;
    for (Parameter p : constructorNode.getParameters()) {
      if ("args".equals(p.getName())) {
        argsParam = p;
        break;
      }
    }
    if (argsParam != null) {
      final Parameter arg = argsParam;
      ClassCodeVisitorSupport variableExpressionFix =
          new ClassCodeVisitorSupport() {
            @Override
            protected SourceUnit getSourceUnit() {
              return cNode.getModule().getContext();
            }

            @Override
            public void visitVariableExpression(final VariableExpression expression) {
              super.visitVariableExpression(expression);
              if ("args".equals(expression.getName())) {
                expression.setAccessedVariable(arg);
              }
            }
          };
      variableExpressionFix.visitConstructor(constructorNode);
    }
  }
  private Statement makeMethodBody(
      ClassNode classNode, MethodSignature methodSignature, Parameter[] parameters) {
    String invokeMethod = methodSignature.isStatic() ? "invokeStatic" : "invokeInstance";
    Expression[] args = new Expression[parameters.length + 2];
    args[0] =
        methodSignature.isStatic()
            ? new ClassExpression(classNode)
            : VariableExpression.THIS_EXPRESSION;
    args[1] = new ConstantExpression(methodSignature.getMethodName());
    int i = 2;
    for (Parameter parameter : parameters) {
      args[i++] = new VariableExpression(parameter.getName());
    }

    return returns(call(getDomainHandlerMethod(classNode), invokeMethod, args(args)));
  }