@Override
  public int tryJoinLines(final @NotNull Document document, final @NotNull PsiFile psiFile, final int start, final int end) {
    if (!PsiUtil.isAvailable(JavaFeature.ENHANCED_SWITCH, psiFile)) return -1;
    PsiElement elementAtStartLineEnd = psiFile.findElementAt(start);
    PsiElement elementAtNextLineStart = psiFile.findElementAt(end);
    if (elementAtStartLineEnd == null || elementAtNextLineStart == null) return -1;
    if (!PsiUtil.isJavaToken(elementAtStartLineEnd, JavaTokenType.COLON)) return -1;
    if (!(elementAtNextLineStart instanceof PsiKeyword) ||
        ((PsiKeyword)elementAtNextLineStart).getTokenType() != JavaTokenType.CASE_KEYWORD) {
      return -1;
    }
    PsiSwitchLabelStatement firstLabel = PsiTreeUtil.getParentOfType(elementAtStartLineEnd, PsiSwitchLabelStatement.class);
    if (firstLabel == null || firstLabel.isDefaultCase()) return -1;
    PsiSwitchLabelStatement secondLabel = PsiTreeUtil.getParentOfType(elementAtNextLineStart, PsiSwitchLabelStatement.class);
    if (secondLabel == null || secondLabel == firstLabel) return -1;
    PsiElement nextToken = PsiTreeUtil.skipWhitespacesForward(elementAtNextLineStart);
    if (nextToken == null) return -1;
    int replaceStart = elementAtStartLineEnd.getTextRange().getStartOffset();
    int replaceEnd = nextToken.getTextRange().getStartOffset();
    boolean spaceAfterComma = CodeStyle.getSettings(psiFile).getCommonSettings(JavaLanguage.INSTANCE).SPACE_AFTER_COMMA;
    document.replaceString(replaceStart, replaceEnd, "," + (spaceAfterComma ? " " : ""));
    return replaceStart;
  }
@Override
  public int tryJoinLines(final @NotNull Document document, final @NotNull PsiFile psiFile, final int start, final int end)