aboutsummaryrefslogtreecommitdiff
path: root/core/src/main/kotlin/Kotlin
diff options
context:
space:
mode:
authorSimon Ogorodnik <Simon.Ogorodnik@jetbrains.com>2017-05-15 15:25:10 +0300
committerSimon Ogorodnik <Simon.Ogorodnik@jetbrains.com>2017-05-15 17:54:20 +0300
commitf9baebebf36904caea48fa45292874f53c4986ab (patch)
treedf3ffbf9be12d59b1ebd53bc02b114d1df07c189 /core/src/main/kotlin/Kotlin
parentfbfaef6a9abdb6743e7e6f9f9bbe7c72595ce0c2 (diff)
downloaddokka-f9baebebf36904caea48fa45292874f53c4986ab.tar.gz
dokka-f9baebebf36904caea48fa45292874f53c4986ab.tar.bz2
dokka-f9baebebf36904caea48fa45292874f53c4986ab.zip
Fix linking to javadoc external static fields
GH-131 fixed
Diffstat (limited to 'core/src/main/kotlin/Kotlin')
-rw-r--r--core/src/main/kotlin/Kotlin/ExternalDocumentationLinkResolver.kt16
1 files changed, 11 insertions, 5 deletions
diff --git a/core/src/main/kotlin/Kotlin/ExternalDocumentationLinkResolver.kt b/core/src/main/kotlin/Kotlin/ExternalDocumentationLinkResolver.kt
index 8113f95d..299492a4 100644
--- a/core/src/main/kotlin/Kotlin/ExternalDocumentationLinkResolver.kt
+++ b/core/src/main/kotlin/Kotlin/ExternalDocumentationLinkResolver.kt
@@ -3,8 +3,10 @@ package org.jetbrains.dokka
import com.google.inject.Inject
import com.intellij.psi.PsiMethod
import org.jetbrains.kotlin.descriptors.*
+import org.jetbrains.kotlin.load.java.descriptors.JavaCallableMemberDescriptor
import org.jetbrains.kotlin.load.java.descriptors.JavaClassDescriptor
import org.jetbrains.kotlin.load.java.descriptors.JavaMethodDescriptor
+import org.jetbrains.kotlin.load.java.descriptors.JavaPropertyDescriptor
import org.jetbrains.kotlin.name.FqName
import org.jetbrains.kotlin.resolve.DescriptorUtils
import org.jetbrains.kotlin.resolve.descriptorUtil.fqNameSafe
@@ -87,14 +89,18 @@ interface InboundExternalLinkResolutionService {
override fun getPath(symbol: DeclarationDescriptor): String? {
if (symbol is JavaClassDescriptor) {
return DescriptorUtils.getFqName(symbol).asString().replace(".", "/") + ".html"
- } else if (symbol is JavaMethodDescriptor) {
+ } else if (symbol is JavaCallableMemberDescriptor) {
val containingClass = symbol.containingDeclaration as? JavaClassDescriptor ?: return null
val containingClassLink = getPath(containingClass)
if (containingClassLink != null) {
- val psi = symbol.sourcePsi() as? PsiMethod
- if (psi != null) {
- val params = psi.parameterList.parameters.joinToString { it.type.canonicalText }
- return containingClassLink + "#" + symbol.name + "(" + params + ")"
+ if (symbol is JavaMethodDescriptor) {
+ val psi = symbol.sourcePsi() as? PsiMethod
+ if (psi != null) {
+ val params = psi.parameterList.parameters.joinToString { it.type.canonicalText }
+ return containingClassLink + "#" + symbol.name + "(" + params + ")"
+ }
+ } else if (symbol is JavaPropertyDescriptor) {
+ return "$containingClassLink#${symbol.name}"
}
}
}