diff options
-rw-r--r-- | dokka-fatjar/build.gradle | 2 | ||||
-rw-r--r-- | lib/kotlin-for-upsource.jar | bin | 13795854 -> 14136706 bytes | |||
-rw-r--r-- | src/Kotlin/DocumentationBuilder.kt | 26 |
3 files changed, 17 insertions, 11 deletions
diff --git a/dokka-fatjar/build.gradle b/dokka-fatjar/build.gradle index e7c9cd97..ffec3b82 100644 --- a/dokka-fatjar/build.gradle +++ b/dokka-fatjar/build.gradle @@ -30,6 +30,7 @@ jar { exclude 'META-INF/*.SF' exclude 'META-INF/*.DSA' exclude 'META-INF/*.RSA' + exclude '**/*.kt' } } from (zipTree(project.file('../out/dokka.jar'))) { @@ -37,6 +38,7 @@ jar { exclude 'META-INF/*.SF' exclude 'META-INF/*.DSA' exclude 'META-INF/*.RSA' + exclude '**/*.kt' } } diff --git a/lib/kotlin-for-upsource.jar b/lib/kotlin-for-upsource.jar Binary files differindex 78096350..e48549d3 100644 --- a/lib/kotlin-for-upsource.jar +++ b/lib/kotlin-for-upsource.jar diff --git a/src/Kotlin/DocumentationBuilder.kt b/src/Kotlin/DocumentationBuilder.kt index bea2f6fa..6c0b7b03 100644 --- a/src/Kotlin/DocumentationBuilder.kt +++ b/src/Kotlin/DocumentationBuilder.kt @@ -18,6 +18,7 @@ import org.jetbrains.kotlin.name.FqName import org.jetbrains.kotlin.psi.JetParameter import org.jetbrains.kotlin.resolve.DescriptorUtils import org.jetbrains.kotlin.resolve.constants.CompileTimeConstant +import org.jetbrains.kotlin.resolve.constants.TypedCompileTimeConstant import org.jetbrains.kotlin.resolve.lazy.ResolveSession import org.jetbrains.kotlin.resolve.source.PsiSourceElement import org.jetbrains.kotlin.resolve.source.getPsi @@ -685,7 +686,7 @@ class DocumentationBuilder(val resolutionFacade: ResolutionFacade, val node = DocumentationNode(annotationClass.getName().asString(), Content.Empty, DocumentationNode.Kind.Annotation) val arguments = getAllValueArguments().toList().sortBy { it.first.getIndex() } arguments.forEach { - val valueNode = it.second.build() + val valueNode = it.second.value.toDocumentationNode() if (valueNode != null) { val paramNode = DocumentationNode(it.first.getName().asString(), Content.Empty, DocumentationNode.Kind.Parameter) paramNode.append(valueNode, DocumentationReference.Kind.Detail) @@ -695,15 +696,18 @@ class DocumentationBuilder(val resolutionFacade: ResolutionFacade, return node } - fun CompileTimeConstant<out Any?>.build(): DocumentationNode? { - val value = getValue() - val valueString = when(value) { - is String -> - "\"" + StringUtil.escapeStringCharacters(value) + "\"" - is EnumEntrySyntheticClassDescriptor -> - value.getContainingDeclaration().getName().asString() + "." + value.getName() - else -> value?.toString() - } - return if (valueString != null) DocumentationNode(valueString, Content.Empty, DocumentationNode.Kind.Value) else null + fun CompileTimeConstant<Any?>.build(): DocumentationNode? { + val value: Any? = if (this is TypedCompileTimeConstant) getValue(type) else null + return value.toDocumentationNode() + } + + private fun Any?.toDocumentationNode(): DocumentationNode? = when (this) { + is String -> + "\"" + StringUtil.escapeStringCharacters(this) + "\"" + is EnumEntrySyntheticClassDescriptor -> + getContainingDeclaration().getName().asString() + "." + getName() + else -> this?.toString() + }.let { valueString -> + if (valueString != null) DocumentationNode(valueString, Content.Empty, DocumentationNode.Kind.Value) else null } } |