private boolean matchAnnotations(@NotNull PsiElement pattern, PsiElement matched) {
    // can't use PsiAnnotationOwner api because it is not implemented completely yet (see e.g., ClsTypeParameterImpl)
    final PsiAnnotation[] annotations = PsiTreeUtil.getChildrenOfType(pattern, PsiAnnotation.class);
    if (annotations == null) {
      return true;
    }
    final PsiAnnotation[] otherAnnotations = PsiTreeUtil.getChildrenOfType(matched, PsiAnnotation.class);
    return otherAnnotations != null && myMatchingVisitor.matchInAnyOrder(annotations, otherAnnotations);
  }
private boolean matchAnnotations(@NotNull PsiElement pattern, PsiElement matched)