List<PsiErrorElement> (PsiFile file) { final Collection<PsiErrorElement> errors = PsiTreeUtil.findChildrenOfType(file, PsiErrorElement.class); final List<PsiErrorElement> errorList = new ArrayList<>(errors); errorList.sort(ERROR_COMPARATOR); file.putUserData(ERRORS, errorList); return errorList; }