@Override
  protected PsiElement restoreBySignatureTokens(@NotNull PsiFile file,
                                                @NotNull PsiElement parent,
                                                @NotNull String type,
                                                @NotNull StringTokenizer tokenizer,
                                                @Nullable StringBuilder processingInfoStorage) {
    return switch (type) {
      case "imports" -> file instanceof PsiJavaFile javaFile ? javaFile.getImportList() : null;
      case "method" -> {
        String name = tokenizer.nextToken();
        try {
          int index = Integer.parseInt(tokenizer.nextToken());
          yield restoreElementInternal(parent, name, index, PsiMethod.class);
        }
        catch (NumberFormatException e) {
          LOG.error(e);
          yield null;
        }
      }
      case "class" -> {
        String name = tokenizer.nextToken();

        PsiNameHelper nameHelper = PsiNameHelper.getInstance(file.getProject());
        if (nameHelper.isIdentifier(name)) {
          int index = 0;
          try {
            index = Integer.parseInt(tokenizer.nextToken());
          }
          catch (NoSuchElementException e) { //To read previous XML versions correctly
          }

          yield restoreElementInternal(parent, name, index, PsiClass.class);
        }
        StringTokenizer tok1 = new StringTokenizer(name, ":");
        int start = Integer.parseInt(tok1.nextToken());
        int end = Integer.parseInt(tok1.nextToken());
        PsiElement element = file.findElementAt(start);
        if (element != null) {
          TextRange range = element.getTextRange();
          while (range != null && range.getEndOffset() < end) {
            element = element.getParent();
            range = element.getTextRange();
          }

          if (range != null && range.getEndOffset() == end && element instanceof PsiClass) {
            yield element;
          }
        }

        yield null;
      }
      case "initializer" -> {
        try {
          int index = Integer.parseInt(tokenizer.nextToken());

          PsiElement[] children = parent.getChildren();
          for (PsiElement child : children) {
            if (child instanceof PsiClassInitializer) {
              if (index == 0) {
                yield child;
              }
              index--;
            }
          }

          yield null;
        }
        catch (NumberFormatException e) {
          LOG.error(e);
          yield null;
        }
      }
      case "field" -> {
        String name = tokenizer.nextToken();

        try {
          int index = 0;
          try {
            index = Integer.parseInt(tokenizer.nextToken());
          }
          catch (NoSuchElementException e) { //To read previous XML versions correctly
          }

          yield restoreElementInternal(parent, name, index, PsiField.class);
        }
        catch (NumberFormatException e) {
          LOG.error(e);
          yield null;
        }
      }
      case "docComment" -> {
        if (parent instanceof PsiClass psiClass) {
          yield psiClass.getDocComment();
        }
        else if (parent instanceof PsiMethod psiMethod) {
          yield psiMethod.getDocComment();
        }
        else if (parent instanceof PsiField psiField) {
          yield psiField.getDocComment();
        }
        else {
          yield null;
        }
      }
      default -> null;
    };
  }
@Override
  protected PsiElement restoreBySignatureTokens(@NotNull PsiFile file,
                                                @NotNull PsiElement parent,
                                                @NotNull String type,
                                                @NotNull StringTokenizer tokenizer,
                                                @Nullable StringBuilder processingInfoStorage)