private static boolean isMergableImplicitIf(PsiElement element) {
    if (!(element instanceof PsiJavaToken token)) {
      return false;
    }

    final PsiElement parent = token.getParent();
    if (!(parent instanceof PsiIfStatement ifStatement)) {
      return false;
    }
    final PsiStatement thenBranch = ifStatement.getThenBranch();
    if (thenBranch == null) {
      return false;
    }
    final PsiStatement elseBranch = ifStatement.getElseBranch();
    if (elseBranch != null) {
      return false;
    }
    if (ControlFlowUtils.statementMayCompleteNormally(thenBranch)) {
      return false;
    }
    final PsiElement nextStatement = PsiTreeUtil.skipWhitespacesForward(ifStatement);
    if (!(nextStatement instanceof PsiIfStatement nextIfStatement)) {
      return false;
    }
    final PsiStatement nextThenBranch = nextIfStatement.getThenBranch();
    return EquivalenceChecker.getCanonicalPsiEquivalence().statementsAreEquivalent(thenBranch, nextThenBranch);
  }
private static boolean isMergableImplicitIf(PsiElement element)