aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-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