Smeagol
Smeagol

Reputation: 632

Is it possible to link Java method from Kotlin comment?

I have an Android project where Java and Kotlin files are mixed. I am writing a comment in one of the Kotlin files and I want to link some method in Java file.

Is this possible? How?

For Kotlin I do:

/**
*    [ResultMatcher.getCount]
*/

But when ResultMatcher is java class it doesn't work. I tried adding different symbols (_,#) and .java or ::class but it didn't help.

Upvotes: 4

Views: 135

Answers (1)

Karol Dowbecki
Karol Dowbecki

Reputation: 44952

Most likely ResultMatcher is not the full qualified name and you don't have an import.

Below works in IntelliJ, you can click on size and it will navigate to the method body:

import java.util.ArrayList

/**
 * [ArrayList.size]
 */
fun main() { }

and this also works:

/**
 * [java.util.ArrayList.size]
 */
fun main() { }

Upvotes: 5

Related Questions