PsiElementVisitor (@NotNull ProblemsHolder holder, boolean isOnTheFly) { return new JavaElementVisitor() { @Override public void visitField(@NotNull PsiField field) { holder.registerProblem(field.getNameIdentifier(), diagnosticText.get()); super.visitField(field); } @Override public void visitElement(@NotNull PsiElement element) { // stall every other element to exacerbate latency problems if the order is wrong TimeoutUtil.sleep(stallMs.get()); } }; }