Upgrade to latest kotlin
diff --git a/dokka-fatjar/build.gradle b/dokka-fatjar/build.gradle
index e7c9cd9..ffec3b8 100644
--- a/dokka-fatjar/build.gradle
+++ b/dokka-fatjar/build.gradle
@@ -30,6 +30,7 @@
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 @@
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
index 7809635..e48549d 100644
--- a/lib/kotlin-for-upsource.jar
+++ b/lib/kotlin-for-upsource.jar
Binary files differ
diff --git a/src/Kotlin/DocumentationBuilder.kt b/src/Kotlin/DocumentationBuilder.kt
index bea2f6f..6c0b7b0 100644
--- a/src/Kotlin/DocumentationBuilder.kt
+++ b/src/Kotlin/DocumentationBuilder.kt
@@ -18,6 +18,7 @@
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 @@
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 @@
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
}
}