void (@NotNull PsiElement element, @NotNull AnnotationHolder holder) { if (!(element instanceof IJPerfFile)) return; PsiElement startCommand = null; PsiElement @NotNull [] children = element.getChildren(); PsiElement currentPsiElement; for (int i = 0; i <= children.length; i++) { //Check the last element if (i == children.length) { checkAndRegisterUnclosedProblem(startCommand, holder); break; } currentPsiElement = children[i]; if (currentPsiElement.getText().startsWith(StartProfileCommand.PREFIX)) { checkAndRegisterUnclosedProblem(startCommand, holder); checkAndRegisterRepeatProblem(startCommand, currentPsiElement, holder); startCommand = currentPsiElement; } else if (currentPsiElement.getText().startsWith(StopProfileCommand.PREFIX)) { startCommand = null; } } }