static HighlightInfo.Builder checkNotAStatement(@NotNull PsiStatement statement) {
    if (PsiUtil.isStatement(statement)) {
      return null;
    }
    PsiElement anchor = statement;
    if (PsiUtilCore.hasErrorElementChild(statement)) {
      boolean allowedError = false;
      if (statement instanceof PsiExpressionStatement) {
        PsiElement[] children = statement.getChildren();
        if (children[0] instanceof PsiExpression && children[1] instanceof PsiErrorElement &&
            ((PsiErrorElement)children[1]).getErrorDescription().equals(JavaPsiBundle.message("expected.semicolon"))) {
          allowedError = true;
          anchor = children[0];
        }
      }
      if (!allowedError) return null;
    }
    boolean isDeclarationNotAllowed = false;
    if (statement instanceof PsiDeclarationStatement) {
      PsiElement parent = statement.getParent();
      isDeclarationNotAllowed = parent instanceof PsiIfStatement || parent instanceof PsiLoopStatement;
    }
    String description = JavaErrorBundle.message(isDeclarationNotAllowed ? "declaration.not.allowed" : "not.a.statement");
    HighlightInfo.Builder error =
      HighlightInfo.newHighlightInfo(HighlightInfoType.ERROR).range(anchor).descriptionAndTooltip(description);
    if (statement instanceof PsiExpressionStatement) {
      List<IntentionAction> registrar = new ArrayList<>();
      HighlightFixUtil.registerFixesForExpressionStatement(statement, registrar);
      QuickFixAction.registerQuickFixActions(error, null, registrar);
      IntentionAction action = PriorityIntentionActionWrapper
        .lowPriority(getFixFactory().createDeleteSideEffectAwareFix((PsiExpressionStatement)statement));
      error.registerFix(action, null, null, null, null);
    }
    return error;
  }
static HighlightInfo.Builder checkNotAStatement(@NotNull PsiStatement statement)