code: private static String getSignature(MethodLiteral<?, ?> method, String[] paramNames,
        String overrideName, int overrideModifiers) throws NoSourceNameException {
      if (paramNames.length != method.getParameterTypes().size()) {
        throw new IllegalArgumentException(
            String.format("Wrong number of parameters provided for method signature, "
                + "expected %d but got %d.", method.getParameterTypes().size(), paramNames.length));
      }
  
      StringBuilder sb = new StringBuilder();
  
      if (overrideModifiers != 0) {
        sb.append(Modifier.toString(overrideModifiers)).append(" ");
      }
  
      if (method.getTypeParameters().length > 0) {
        List<String> typeParameters = new ArrayList<String>();
        for (TypeVariable<?> typeVariable : method.getTypeParameters()) {
          typeParameters.add(getTypeVariableDefinition(typeVariable));
        }
        sb.append("<").append(join(", ", typeParameters)).append("> ");
      }
  
      if (!method.isConstructor()) {
        sb.append(getSourceName(method.getReturnType())).append(" ");
        if (overrideName != null) {
          sb.append(overrideName);
        } else {
          sb.append(method.getName());
        }
      } else {
        sb.append(getSourceName(method.getRawDeclaringType()));
      }
      sb.append("(");
  
      // TODO(schmitt): We are not respecting varargs here.
      List<String> parameters = new ArrayList<String>();
      int i = 0;
      for (TypeLiteral<?> parameterType : method.getParameterTypes()) {
        parameters.add(
            String.format("%s %s", getSourceName(parameterType), paramNames[i]));
        i++;
      }
      sb.append(join(", ", parameters)).append(")");
  
      if (method.getExceptionTypes().size() > 0) {
        List<String> exceptions = new ArrayList<String>();
        for (TypeLiteral<?> exceptionType : method.getExceptionTypes()) {
          exceptions.add(getSourceName(exceptionType));
        }
        sb.append(" throws ").append(join(", ", exceptions));
      }
  
      return sb.toString();
    }
docs: TODO(schmitt): Print method and parameter annotations.