14

In Java, if you want to document a package, it has to be put into the package-info.class file. Is that still the same thing with Kotlin and KDoc?

I've looked through some of the Kotlin source and can't find where their package documentation is written.

3

1 Answer 1

7

You use the include Dokka configuration option.

See: https://github.com/Kotlin/dokka/blob/master/README.md

Example: https://github.com/JetBrains/kotlin/blob/58e93d5e1bb547c8a7e398587b6851ccf6372326/libraries/build-docs.xml

Sign up to request clarification or add additional context in comments.

3 Comments

As lousy as package-info is, I like it better than having to manually tell the generator to include certain files.
Kotlin can't use the package-info approach because the package structure in Kotlin doesn't need to match the directory structure. And with Dokka you can have one file with the descriptions of all of your packages, and not one file per package as in Java.
@yole "One file per package as in Java" is sometimes a more desirable approach. In Java/Javadoc, you have more freedom, as you can create either an overview.html page (one for all your packages), or separate package-info.java (per package), or both.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.