private static String formatMethodSignature(@NotNull PsiMethod method, @NotNull LanguageLevel languageLevel) {
    boolean replaceConstructorWithInit = languageLevel.isAtLeast(LanguageLevel.JDK_10) && method.isConstructor();

    int options = (replaceConstructorWithInit ? 0 : PsiFormatUtilBase.SHOW_NAME) | PsiFormatUtilBase.SHOW_PARAMETERS;
    int parameterOptions = PsiFormatUtilBase.SHOW_TYPE | PsiFormatUtilBase.SHOW_FQ_CLASS_NAMES | PsiFormatUtilBase.SHOW_RAW_NON_TOP_TYPE;

    if (languageLevel.isAtLeast(LanguageLevel.JDK_15)) {
      parameterOptions |= PsiFormatUtilBase.SHOW_RAW_TYPE;
    }

    String signature = PsiFormatUtil.formatMethod(method, PsiSubstitutor.EMPTY, options, parameterOptions, 999);
    if (replaceConstructorWithInit) {
      signature = "<init>" + signature;
    }

    if (languageLevel.isAtLeast(LanguageLevel.JDK_10)) {
      signature = signature.replace(" ", "");
    }
    else if (languageLevel.isAtLeast(LanguageLevel.JDK_1_8)) {
      signature = signature.replaceAll("\\(|\\)|, ", "-").replaceAll("\\[]", ":A");
    }

    return signature;
  }
private static String formatMethodSignature(@NotNull PsiMethod method, @NotNull LanguageLevel languageLevel)