代码之家  ›  专栏  ›  技术社区  ›  Sachin

IntelliJ不断给出无法解析jdocs/kdocs中的@param

  •  2
  • Sachin  · 技术社区  · 4 月前

    不知道我做错了什么

    /**
     * Converts a DTO to its entity representation.
     *
     * @param dto The source DTO
     * @return [EmergencyContactEntity] containing the mapped data
     */
    /***********************/
    /* FROM DTO TO ENTITY. */
    /***********************/
    internal fun toEntity(dto: EmergencyContactDTO): EmergencyContactEntity {
        return EmergencyContactDTOEntityMapMapper.toEntity(dto)
    }
    

    在我将代码推送到仓库之前,IntelliJ给出了:

    Warning:(24, 15) Cannot resolve symbol 'dto'
    

    有什么想法吗?

    1 回复  |  直到 4 月前
        1
  •  2
  •   Sweeper    4 月前

    在文档注释和函数声明之间,您有以下注释块

    /***********************/
    /* FROM DTO TO ENTITY. */
    /***********************/
    

    最后一行以 /** ,因此最后一行被视为与函数关联的文档注释。因此,最初的实际文档注释 不被视为记录函数声明 .

    假设您不希望“从DTO到实体”成为文档的一部分,您应该使用 // 评论。

    /**
     * Converts a DTO to its entity representation.
     *
     * @param dto The source DTO
     * @return [EmergencyContactEntity] containing the mapped data
     */
    ///***********************/
    ///* FROM DTO TO ENTITY. */
    ///***********************/
    internal fun toEntity(dto: EmergencyContactDTO): EmergencyContactEntity
    

    因为这是一个 // 评论,你不需要那么多斜线。在我看来,这看起来更好:

    //***********************
    //* FROM DTO TO ENTITY. *
    //***********************
    

    或者,您可以用以下内容开始常规的阻止评论 /* (不是 /** !)刚过 */ 文件注释:

    /**
     * Converts a DTO to its entity representation.
     *
     * @param dto The source DTO
     * @return [EmergencyContactEntity] containing the mapped data
     *//*
    ***********************
    * FROM DTO TO ENTITY. *
    ***********************/
    internal fun toEntity(dto: EmergencyContactDTO): EmergencyContactEntity
    

    注: