PsiElementVisitor (@NotNull final ProblemsHolder holder, boolean isOnTheFly) { return new JavaElementVisitor() { final Pair<String, ? extends Set<String>> annotationName = Configuration.getProjectInstance(holder.getProject()).getAdvancedConfiguration().getLanguageAnnotationPair(); @Override public void visitExpression(@NotNull PsiExpression expression) { checkExpression(expression, holder, annotationName); } @Override public void visitReferenceExpression(@NotNull PsiReferenceExpression expression) { if (expression.getParent() instanceof PsiMethodCallExpression) return; final PsiElement element = expression.resolve(); if (!(element instanceof PsiModifierListOwner)) { return; } checkExpression(expression, holder, annotationName); } }; }