@Override
  public @NotNull PsiSymbolReference getInheritDocSymbol(@NotNull PsiDocToken token) {
    return new PsiSymbolReference() {
      @Override
      public @NotNull PsiElement getElement() {
        return token;
      }

      @Override
      public @NotNull TextRange getRangeInElement() {
        return token.getTextRangeInParent().shiftLeft(1);
      }

      @Override
      public @NotNull Collection<? extends Symbol> resolveReference() {
        final PsiDocComment docComment = PsiTreeUtil.getParentOfType(token, PsiDocComment.class);
        if (docComment == null) return List.of();
        if (docComment.getOwner() instanceof PsiMethod method) {
          final PsiDocTagImpl docTag = PsiTreeUtil.getParentOfType(token, PsiDocTagImpl.class);
          var containingClass = method.getContainingClass();
          if (containingClass == null) return List.of();

          final var valueElement = token.getParent() instanceof PsiDocTag tag ? tag.getValueElement() : null;
          final var target = findTargetRecursively(containingClass, method, docTag, valueElement != null ? valueElement.getText() : null, false, new HashSet<>());
          if (target != null) {
            return List.of(new SnippetRegionSymbol(target.getContainingFile(), getSnippetRange(target)));
          }
        }

        return List.of();
      }

      private static TextRange getSnippetRange(PsiElement target) {
        if (target instanceof PsiDocTag) {
          final var lines = target.getText().split("\n");
          if (lines.length > 1 && lines[lines.length - 1].matches("\\s*\\*\\s*")) {
            return target.getTextRange().grown(-lines[lines.length - 1].length());
          }
        }
        return target.getTextRange();
      }

      /**
       * Performs Automatic Supertype Search as described in the JavaDoc Documentation Comment Specification.
       */
      private static @Nullable PsiElement findTargetRecursively(@NotNull PsiClass psiClass,
                                                                @NotNull PsiMethod method,
                                                                @Nullable PsiDocTag docTag,
                                                                @Nullable String explicitSuper,
                                                                boolean checkClass,
                                                                @NotNull HashSet<PsiClass> visitedSet) {
        if ("java.lang.Object".equals(psiClass.getQualifiedName())) return null;
        if (visitedSet.contains(psiClass)) return null;

        visitedSet.add(psiClass);

        // Check class
        PsiElement target = null;
        if (checkClass) target = findTarget(psiClass, method, docTag, explicitSuper);
        if (target != null) return target;

        // Check super class
        final PsiClass superClass = psiClass.getSuperClass();
        if (superClass != null) {
          target = findTargetRecursively(superClass, method, docTag, explicitSuper, true, visitedSet);
          if (target != null) return target;
        }

        // Check interfaces
        var targetInInterface = Stream.concat(Stream.of(psiClass.getImplementsListTypes()), Stream.of(psiClass.getExtendsListTypes()))
          .map(type -> type.resolve())
          .map(resolvedType -> findTarget(resolvedType, method, docTag, explicitSuper))
          .filter(Objects::nonNull)
          .findFirst();

        return targetInInterface.orElse(null);
      }

      private static @Nullable PsiElement findTarget(@Nullable PsiClass psiClass,
                                                     @NotNull PsiMethod method,
                                                     @Nullable PsiDocTag docTag,
                                                     @Nullable String explicitSuper) {
        if (psiClass == null || explicitSuper != null && !explicitSuper.equals(psiClass.getName())) {
          return null;
        }

        final var matchedMethod = psiClass.findMethodBySignature(method, false);
        if (matchedMethod == null) return null;

        PsiDocComment docComment = matchedMethod.getDocComment();
        if (docComment == null) return null;

        // inheritDoc is not in a tag -> the target is the PsiDocComment
        if (docTag == null) return docComment;

        // Searching for a matching tag
        final PsiDocTagValue tagValue = docTag.getValueElement();
        for (PsiDocTag tag : docComment.findTagsByName(docTag.getName())) {
          final var matchedTagValueElement = tag.getValueElement();
          if (tagValue != null && matchedTagValueElement == null) continue;
          if (tagValue == null || tagValue.getText().equals(matchedTagValueElement.getText())) {
            return tag;
          }
        }

        return null;
      }
    };
  }
@Override
  public @NotNull PsiSymbolReference getInheritDocSymbol(@NotNull PsiDocToken token)