void (@NotNull PsiElement problemElement, PsiElement anchor) { PsiElement start = null; PsiElement end = null; while (anchor != null) { if (anchor instanceof PsiAnnotation) { if (start == null) start = anchor; } else if (PsiUtil.isJavaToken(anchor, HighlightUtil.BRACKET_TOKENS)) { if (start == null) start = anchor; end = anchor; } anchor = anchor.getNextSibling(); } if (start != null && end != null) registerErrorAtRange(start, end, problemElement); }