aboutsummaryrefslogtreecommitdiff
path: root/core/src
diff options
context:
space:
mode:
authorSimon Ogorodnik <Simon.Ogorodnik@jetbrains.com>2017-11-07 16:10:05 +0300
committerSimon Ogorodnik <Simon.Ogorodnik@jetbrains.com>2017-11-07 16:10:05 +0300
commit9c1d23b8bfa74b74a036d9500d8f8d57c978e553 (patch)
treea98a7b961f1d8cade8918d2c65330a9a5b03ff4c /core/src
parent694d51d7bb5a5900fb30d201a8d675cec0f5e92b (diff)
downloaddokka-9c1d23b8bfa74b74a036d9500d8f8d57c978e553.tar.gz
dokka-9c1d23b8bfa74b74a036d9500d8f8d57c978e553.tar.bz2
dokka-9c1d23b8bfa74b74a036d9500d8f8d57c978e553.zip
Fix problem with Java descriptors
Diffstat (limited to 'core/src')
-rw-r--r--core/src/main/kotlin/Kotlin/KotlinAsJavaDescriptorSignatureProvider.kt9
1 files changed, 7 insertions, 2 deletions
diff --git a/core/src/main/kotlin/Kotlin/KotlinAsJavaDescriptorSignatureProvider.kt b/core/src/main/kotlin/Kotlin/KotlinAsJavaDescriptorSignatureProvider.kt
index ca15b89f..266361f2 100644
--- a/core/src/main/kotlin/Kotlin/KotlinAsJavaDescriptorSignatureProvider.kt
+++ b/core/src/main/kotlin/Kotlin/KotlinAsJavaDescriptorSignatureProvider.kt
@@ -9,9 +9,14 @@ import org.jetbrains.kotlin.psi.KtElement
class KotlinAsJavaDescriptorSignatureProvider : DescriptorSignatureProvider {
override fun signature(forDesc: DeclarationDescriptor): String {
+ val sourcePsi = forDesc.sourcePsi()
+ val javaLikePsi = if (sourcePsi is KtElement) {
+ sourcePsi.toLightElements().firstOrNull()
+ } else {
+ sourcePsi
+ }
- val sourcePsi = forDesc.sourcePsi() as? KtElement
- return getSignature(sourcePsi?.toLightElements().orEmpty().firstOrNull()) ?:
+ return getSignature(javaLikePsi) ?:
throw UnsupportedOperationException("Don't know how to calculate signature for $forDesc")
}
} \ No newline at end of file