blob: 20ea179ee25fe61c0da74c072f21d91ec2b57bb9 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
|
package org.jetbrains.dokka
import com.intellij.psi.PsiElement
import org.jetbrains.kotlin.asJava.toLightElements
import org.jetbrains.kotlin.descriptors.DeclarationDescriptor
import org.jetbrains.kotlin.psi.KtElement
class KotlinAsJavaElementSignatureProvider : ElementSignatureProvider {
private fun PsiElement.javaLikePsi() = when {
this is KtElement -> toLightElements().firstOrNull()
else -> this
}
override fun signature(forPsi: PsiElement): String {
return getSignature(forPsi.javaLikePsi()) ?:
"not implemented for $forPsi"
}
override fun signature(forDesc: DeclarationDescriptor): String {
val sourcePsi = forDesc.sourcePsi()
return getSignature(sourcePsi?.javaLikePsi()) ?:
"not implemented for $forDesc with psi: $sourcePsi"
}
}
|