public void registerIncompatibleErrorMessage(Collection<InferenceVariable> variables, @Nls String incompatibleTypesMessage) {
    variables = new ArrayList<>(variables);
    ((ArrayList<InferenceVariable>)variables).sort((v1, v2) -> Comparing.compare(v1.getName(), v2.getName()));
    final String variablesEnumeration = StringUtil.join(variables, variable -> variable.getParameter().getName(), ", ");
    if (variablesEnumeration.isEmpty()) {
      registerIncompatibleErrorMessage(JavaPsiBundle.message("error.incompatible.type.no.type.variable", incompatibleTypesMessage));
    }
    else {
      registerIncompatibleErrorMessage(
        JavaPsiBundle.message("error.incompatible.type.no.type.variable.0", variablesEnumeration, incompatibleTypesMessage));
    }
  }
public void registerIncompatibleErrorMessage(Collection<InferenceVariable> variables, @Nls String incompatibleTypesMessage)