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

在何处放置Kotlin文件的文档(不是包,不是模块,不是类)

  •  4
  • Tobia  · 技术社区  · 7 年前

    关于Kotlin源文件的注释应该放在哪里?

    类和其他对象具有KDoc:

    /**
     * Summary
     *
     * Rest of documentation goes here.
     */
    class A {
        ...
    }
    

    但是我应该把这样的东西放在哪里呢?

    // This file contains constants shared between frontend and backend.
    // Make sure not to use any JVM- or JS-specific import.
    // ...
    

    在 package

    2 回复  |  直到 7 年前
        1
  •  2
  •   yole    7 年前

    文件不是API的一部分,因此没有地方可以放置文件的文档以便Dokka挑选。您应该对此类文档使用常规(而不是KDoc)注释,并将其放在便于读者查找的位置(很可能在imports块之后),因为机器不需要这些信息。

        2
  •  0
  •   Narek Hayrapetyan    7 年前

    package 宣言

    如果您正在使用doc comment about information for your file,您可以将其放在 imports

    推荐文章