public PsiAnnotationPattern insideAnnotationAttribute(@NotNull final String attributeName, @NotNull final ElementPattern<PsiAnnotation> parentAnnoPattern) { return with(new PatternCondition<PsiAnnotation>("insideAnnotationAttribute") { final PsiNameValuePairPattern attrPattern = PsiJavaPatterns.psiNameValuePair().withName(attributeName).withSuperParent(2, parentAnnoPattern); @Override public boolean accepts(@NotNull PsiAnnotation annotation, ProcessingContext context) { PsiElement attr = getParent(annotation); if(attr instanceof PsiArrayInitializerMemberValue) { attr = getParent(attr); } return attrPattern.accepts(attr); } }); }
@Override public void visitAnnotationArrayInitializer(PsiArrayInitializerMemberValue initializer) { mVisitor.report("PsiArrayInitializerMemberValue", initializer.getText(), initializer); super.visitElement(initializer); }