@Override
  protected void setMirror(@NotNull TreeElement element) throws InvalidMirrorException {
    setMirrorCheckingType(element, JavaElementType.MODIFIER_LIST);
    PsiAnnotation[] annotations = getAnnotations();
    PsiAnnotation[] mirrorAnnotations = SourceTreeToPsiMap.<PsiModifierList>treeToPsiNotNull(element).getAnnotations();
    // Annotations could be inconsistent, as in stubs all type annotations are attached to the types
    // not to modifier list
    Map<String, PsiAnnotation> annotationByShortName = getAnnotationByShortName(annotations);
    Map<String, PsiAnnotation> mirrorAnnotationByShortName = getAnnotationByShortName(mirrorAnnotations);
    if (!annotationByShortName.containsKey(null) &&
        !mirrorAnnotationByShortName.containsKey(null) &&
        annotationByShortName.size() == annotations.length &&
        mirrorAnnotationByShortName.size() == mirrorAnnotations.length) {
      //it is possible to work with short name without resolving
      for (Map.Entry<String, PsiAnnotation> annotationEntry : annotationByShortName.entrySet()) {
        String key = annotationEntry.getKey();
        PsiAnnotation mirror = mirrorAnnotationByShortName.get(key);
        if (mirror != null) {
          PsiAnnotation annotation = annotationEntry.getValue();
          setMirror(annotation, mirror);
        }
      }
      return;
    }
    DumbService.getInstance(getProject()).runWithAlternativeResolveEnabled(() -> {
      //necessary to use AlternativeResolver, because of getQualifiedName()
      for (PsiAnnotation annotation : annotations) {
        String qualifiedName = annotation.getQualifiedName();
        if (qualifiedName != null) {
          PsiAnnotation mirror = ContainerUtil.find(mirrorAnnotations, m -> qualifiedName.equals(m.getQualifiedName()));
          if (mirror != null) {
            setMirror(annotation, mirror);
          }
        }
      }
    });
  }
@Override
  protected void setMirror(@NotNull TreeElement element)