ReadActionProcessor<PsiReference> (@NotNull Processor<? super PsiReference> consumer) { return new ReadActionProcessor<>() { @Override public boolean processInReadAction(final PsiReference reference) { if (reference instanceof PsiJavaCodeReferenceElement javaReference && javaReference.getParent() instanceof PsiAnnotation annotation) { PsiNameValuePair[] members = annotation.getParameterList().getAttributes(); if (members.length == 1 && members[0].getNameIdentifier() == null) { PsiReference t = members[0].getReference(); return t == null || consumer.process(t); } } return true; } }; }