private static Map<String, Object> collectContextAttributes(PsiJavaDocumentedElement commentOwner){
    HashMap<String, Object> attributes = new HashMap<>();
    if (commentOwner instanceof PsiMember member){
      String name = member.getName();
      if (name != null) {
        attributes.put("ELEMENT_NAME", name);
      }
      PsiClass containingClass = member.getContainingClass();
      String className = containingClass != null ? containingClass.getName() : null;
      if (className != null) {
        attributes.put("CONTAINING_CLASS", className);
      }
    }
    if (commentOwner instanceof PsiMethod method) {
      PsiParameter[] parameters = method.getParameterList().getParameters();
      attributes.put("PARAMS", ContainerUtil.map(parameters, param -> param.getName()));
      attributes.put("TYPE_PARAMS", ContainerUtil.map(method.getTypeParameters(), param -> param.getName()));
      attributes.put("THROWS", ContainerUtil.map(method.getThrowsList().getReferenceElements(), reference -> reference.getText()));
      PsiTypeElement returnElement = method.getReturnTypeElement();
      if (returnElement != null) {
        attributes.put("RETURN_TYPE", String.valueOf(returnElement.getText()));
      }

      PsiMethod[] superMethods = method.findSuperMethods();
      if (superMethods.length > 0) {
        PsiMethod superMethod = superMethods[0];
        String qualifiedSuperMethod = FqnUtil.getQualifiedNameFromProviders(superMethod);
        if (qualifiedSuperMethod != null) {
          attributes.put("SUPER_METHOD", qualifiedSuperMethod);
        }
        Map<Integer, String> paramToParentDescription = collectParentParameterDescriptions(method, parameters);
        if (! paramToParentDescription.isEmpty()) {
          List<String> inheritedParams = IntStream
            .range(0, parameters.length)
            .mapToObj(i -> parameters[i].getName() + StringUtil.notNullize(paramToParentDescription.get(i)))
            .collect(Collectors.toList());
          attributes.put("PARAMS_INHERITED", inheritedParams);
        }
      }
    }
    if (commentOwner instanceof PsiClass psiClass) {
      attributes.put("TYPE_PARAMS", ContainerUtil.map(psiClass.getTypeParameters(), param -> param.getName()));
      if (psiClass.isInterface()){
        attributes.put("INTERFACE", String.valueOf(true));
      }
      if (psiClass.isEnum()){
        attributes.put("ENUM", String.valueOf(true));
      }
      if (psiClass.isRecord()){
        attributes.put("RECORD", String.valueOf(true));
        attributes.put("RECORD_COMPONENTS", ContainerUtil.map(psiClass.getRecordComponents(), param -> param.getName()));
      }
      String className = psiClass.getName();
      if (className != null) {
        attributes.put("CONTAINING_CLASS", psiClass.getName());
      }
    }
    return attributes;
  }
private static Map<String, Object> collectContextAttributes(PsiJavaDocumentedElement commentOwner)