Questions tagged [kdoc]

KDoc is a documentation generation system which reads specially formatted comments in Kotlin source code and generates compiled documentation. It is typically used to produce API documentation in the form of HTML web pages.

Resources

Documenting Kotlin code

70 questions
10
votes
0 answers

How do I inherit KDoc documentation in Java class?

I have Kotlin classes with KDoc, for example: abstract class Something { /** # Documentation */ abstract fun someFun() } This class is extended by Kotlin and Java classes. KDoc is correctly inherited by Kotlin classes. KDoc is shown upon…
Yuriy Kulikov
  • 2,059
  • 1
  • 16
  • 29
9
votes
1 answer

Kotlin: How can I reference a method in kDoc using @see?

I used to reference methods in Java Doc like this: /** * @see com.myapp.view.fragment.PlaybackControlFragment#onPlaybackStateChanged */ I don't know how to reference same method in kotlin? The part com.myapp.view.fragment.PlaybackControlFragment…
VSB
  • 9,825
  • 16
  • 72
  • 145
9
votes
1 answer

How should Kotlin function typealises be documented?

In Kotlin v1.1+, there is the option of declaring type aliases, which provide alternative names for existing types. This is particularly useful for function types - for example: typealias OnItemClick = (view: View, position: Int) -> Boolean And…
Farbod Salamat-Zadeh
  • 19,687
  • 20
  • 75
  • 125
9
votes
1 answer

Copy KDoc docs from one method to another

For the two given methods: /** * Adds a [DataItem] to the Android Wear network. The updated item is synchronized across all devices. */ fun putItem(){ .... } /** * "same KDOC here with above" */ fun putItem(putRequest: PutDataRequest){ .... } Is…
Diolor
  • 13,181
  • 30
  • 111
  • 179
8
votes
2 answers

Tables in KDoc?

We usually have changelog in our Java DTO's that consists of a table defined in Javadoc: /** * Changelog: * * * * * *
VersionDescription
2Added field…
Johan
  • 37,479
  • 32
  • 149
  • 237
8
votes
1 answer

Kotlin: Documentation for property setter

I am writing a Kotlin library. In one of the classes, I have the following: class SessionWrapper { /** * The time in milliseconds after which the session will expire. */ var expiryTime = DEFAULT_EXPIRY_TIME get() { …
cjurjiu
  • 1,758
  • 13
  • 21
7
votes
2 answers

Where to put documentation for a Kotlin file (not package, not module, not class)

Where should I put a comment about a Kotlin source file? Classes and other objects have KDoc: /** * Summary * * Rest of documentation goes here. */ class A { ... } But where should I put something like this? // This file contains constants…
Tobia
  • 17,856
  • 6
  • 74
  • 93
7
votes
1 answer

Kotlin KDoc: Documentation?

I have seen here, here and there references to KDoc, the JavaDoc utility equivalent for Kotlin. However, I cannot find any documentation on how to use it, let alone how to customize it or integrate it in Maven or Gradle. I know the Kotlin API doc is…
Salomon BRYS
  • 9,247
  • 5
  • 29
  • 44
6
votes
1 answer

Where do I find the samples referred to by Jetpack Compose source documentation?

The KDoc contains links as to some package and Kotlin file, but I can't see such packages and files actually Documentation window screenshot I looked through the Google Maven repository, expecting to find that I just haven't included some package in…
Vitalis11
  • 99
  • 9
6
votes
0 answers

Problem with dokka CLI - "Exiting Generation: Nothing to document"

I'm trying to generate documentation for my kotlin code. Some of my classes and functions have KDOC comments. I tried to run dokka from the CLI like this: java -jar dokka-cli-1.4.20.jar And the result was: WARN: Dokka 1.4.* is an alpha project…
MyName
  • 2,136
  • 5
  • 26
  • 37
6
votes
1 answer

Reference value of constant with KDoc

I have a object like the following in my project object UrlUtils { private const val PARAM = "whatever" /** * Method that appends the [PARAM] parameter to the url */ fun appendParameter(url: String) { // ... …
user3420815
  • 775
  • 9
  • 20
6
votes
2 answers

How to escape symbols in Kotlin documentation Dokka/Kdoc?

I want to add a comment like this /** * @param scrollFraction In range [0..1]. */ But Dokka/Kdoc interprets stuff inside square brackets as a reference. This leads to badly rendered comments when you check the function's documentation in…
Dmitry Ryadnenko
  • 22,222
  • 4
  • 42
  • 56
6
votes
1 answer

Combining multiple source language documentations into a single Javadoc JAR

If I have a project that has java, groovy, and kotlin plugins applied with code written in each, how do I create (and should I) create a single javadoc.jar distribution with all of the code documentation? The java plugin gives me the javadoc class,…
mkobit
  • 43,979
  • 12
  • 156
  • 150
5
votes
1 answer

How do I document a Kotlin package like with the Java `package-info.java` in an IntelliJ IDEA/Gradle project?

kotlinlang.org says that a separate markdown file documents all packages. Is there a canonical path for that markdown file in an IntelliJ IDEA project? Is there a canonical way to process that file with Gradle? Is there a way to have these .md files…
Travis Well
  • 947
  • 10
  • 32
5
votes
1 answer

Kotlin static field value in method documentation?

I was wondering if there is a possibility to include the value of a static field of a class into the documentation of a class method. We can link class members and parameters via square brackets: /** * Sets the title of the notification dialog…
Trickzter
  • 471
  • 3
  • 14