Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Javadoc @link to Kotlin classes

This is my javadoc

/**
 * If you wish to add this fragment to your activity, you must implement {@link com.example.app.BlaActivity BlaActivity}
 *
 * @return an instance of BlaFragment
 */

BlaActivity is a Kotlin class. When I hover over the method with the javadoc above, the popup says:

If you wish to add this fragment to your activity, you must implement

Returns:
        an instance of BlaFragment

So, it does not show my Kotlin class in the popup. However it works fine when I use a Java class.

Javadoc has no support for Kotlin classes?

like image 237
Egemen Hamutçu Avatar asked Nov 07 '18 08:11

Egemen Hamutçu


People also ask

Does Javadoc work with Kotlin?

Just like Kotlin, Dokka fully supports cross-language Java/Kotlin projects. It can read Javadoc comments in Java code and KDoc comments in Kotlin code and generate documentation covering the entire API of a module, regardless of the language used to write each class in it.

How do I use KDoc?

For inline markup, KDoc uses the regular Markdown syntax, extended to support a shorthand syntax for linking to other elements in the code. To link to another element (class, method, property or parameter), simply put its name in square brackets: Use the method [foo] for this purpose.

How do I comment with Kotlin code?

Single-line comments starts with two forward slashes ( // ). Any text between // and the end of the line is ignored by Kotlin (will not be executed).


1 Answers

Kotlin have different syntax for linking. Base on kotlinlang.org

Instead of

{@link com.example.app.BlaActivity}

Use [ like this

[com.example.app.BlaActivity]
like image 92
Radesh Avatar answered Nov 03 '22 01:11

Radesh