private static @NotNull PsiElement getLastStatement(@NotNull PsiStatement statement) {
    PsiElement lastStatement = statement;
    while (true) {
      PsiElement nextStatement = PsiTreeUtil.skipWhitespacesAndCommentsForward(lastStatement);
      if (!(nextStatement instanceof PsiStatement) || nextStatement instanceof PsiSwitchLabelStatement) break;
      lastStatement = nextStatement;
    }
    return lastStatement;
  }
private static @NotNull PsiElement getLastStatement(@NotNull PsiStatement statement)