static HighlightInfo.Builder checkGuard(@NotNull PsiSwitchLabelStatementBase statement, @NotNull LanguageLevel languageLevel,
                                          @NotNull PsiFile psiFile) {
    PsiExpression guardingExpr = statement.getGuardExpression();
    if (guardingExpr == null) return null;
    HighlightInfo.Builder info =
      HighlightUtil.checkFeature(guardingExpr, JavaFeature.PATTERN_GUARDS_AND_RECORD_PATTERNS, languageLevel, psiFile);
    if (info != null) {
      return info;
    }
    PsiCaseLabelElementList list = statement.getCaseLabelElementList();
    if (list != null) {
      if (!ContainerUtil.exists(list.getElements(), e -> e instanceof PsiPattern)) {
        return HighlightInfo.newHighlightInfo(HighlightInfoType.ERROR).range(guardingExpr)
          .descriptionAndTooltip(JavaErrorBundle.message("error.guard.allowed.after.patterns.only"));
      }
    }
    HighlightInfo.Builder info2 = checkGuardingExpressionHasBooleanType(guardingExpr);
    if (info2 != null) {
      return info2;
    }
    Object constVal = ExpressionUtils.computeConstantExpression(guardingExpr);
    if (Boolean.FALSE.equals(constVal)) {
      String message = JavaErrorBundle.message("when.expression.is.false");
      return HighlightInfo.newHighlightInfo(HighlightInfoType.ERROR).range(guardingExpr).descriptionAndTooltip(message);
    }
    return null;
  }
static HighlightInfo.Builder checkGuard(@NotNull PsiSwitchLabelStatementBase statement, @NotNull LanguageLevel languageLevel,
                                          @NotNull PsiFile psiFile)