PsiElementVisitor (@NotNull ProblemsHolder holder, boolean isOnTheFly) { return new JavaElementVisitor() { @Override public void visitIdentifier(@NotNull PsiIdentifier identifier) { super.visitIdentifier(identifier); if (identifier.getText().contains("XXX")) { holder.registerProblem(identifier.getContainingFile(),"blah", ProblemHighlightType.WARNING); } } }; }