aboutsummaryrefslogtreecommitdiff
path: root/core/src
diff options
context:
space:
mode:
authorSimon Ogorodnik <Simon.Ogorodnik@jetbrains.com>2018-01-20 17:26:00 +0300
committerSimon Ogorodnik <Simon.Ogorodnik@jetbrains.com>2018-07-13 18:31:20 +0300
commit85d2ea3a100001d3e5555786202e64ef3ea1679e (patch)
tree154a59a6a5c9901a4879139a0f053fe6767727f5 /core/src
parent2f1512f5ec7f23181cf5fcad96d9ee66507de472 (diff)
downloaddokka-85d2ea3a100001d3e5555786202e64ef3ea1679e.tar.gz
dokka-85d2ea3a100001d3e5555786202e64ef3ea1679e.tar.bz2
dokka-85d2ea3a100001d3e5555786202e64ef3ea1679e.zip
[backport] Support constants from Java in KK mode
Original: 7723826
Diffstat (limited to 'core/src')
-rw-r--r--core/src/main/kotlin/Kotlin/DocumentationBuilder.kt13
1 files changed, 10 insertions, 3 deletions
diff --git a/core/src/main/kotlin/Kotlin/DocumentationBuilder.kt b/core/src/main/kotlin/Kotlin/DocumentationBuilder.kt
index 39202173..d22c48f9 100644
--- a/core/src/main/kotlin/Kotlin/DocumentationBuilder.kt
+++ b/core/src/main/kotlin/Kotlin/DocumentationBuilder.kt
@@ -2,6 +2,7 @@ package org.jetbrains.dokka
import com.google.inject.Inject
import com.intellij.openapi.util.text.StringUtil
+import com.intellij.psi.PsiField
import com.intellij.psi.PsiJavaFile
import org.jetbrains.dokka.DokkaConfiguration.*
import org.jetbrains.dokka.Kotlin.DescriptorDocumentationParser
@@ -782,12 +783,18 @@ class DocumentationBuilder
if (isVar) {
node.appendTextNode("var", NodeKind.Modifier)
}
+
if (isConst) {
- val psi = sourcePsi() as? KtVariableDeclaration
- val text = psi?.initializer?.text
- text?.let { node.appendTextNode(it, NodeKind.Value) }
+ val psi = sourcePsi()
+ val valueText = when (psi) {
+ is KtVariableDeclaration -> psi.initializer?.text
+ is PsiField -> psi.initializer?.text
+ else -> null
+ }
+ valueText?.let { node.appendTextNode(it, NodeKind.Value) }
}
+
getter?.let {
if (!it.isDefault) {
node.addAccessorDocumentation(descriptorDocumentationParser.parseDocumentation(it), "Getter")