aboutsummaryrefslogtreecommitdiff
path: root/plugins/base/src/main/kotlin/translators/psi
diff options
context:
space:
mode:
authorvmishenev <vad-mishenev@yandex.ru>2021-07-23 15:26:40 +0300
committerGitHub <noreply@github.com>2021-07-23 14:26:40 +0200
commit355acd296ac16902f588a879e99efd548f0dc0e7 (patch)
tree4febf3b6fb5531ab2b33c8b070ee695b087a0e98 /plugins/base/src/main/kotlin/translators/psi
parentbb712835958c823e06db8c39c0a1d32493f095b8 (diff)
downloaddokka-355acd296ac16902f588a879e99efd548f0dc0e7.tar.gz
dokka-355acd296ac16902f588a879e99efd548f0dc0e7.tar.bz2
dokka-355acd296ac16902f588a879e99efd548f0dc0e7.zip
Add numeric types of annotation parameter value (#2035)
Diffstat (limited to 'plugins/base/src/main/kotlin/translators/psi')
-rw-r--r--plugins/base/src/main/kotlin/translators/psi/DefaultPsiToDocumentableTranslator.kt9
1 files changed, 9 insertions, 0 deletions
diff --git a/plugins/base/src/main/kotlin/translators/psi/DefaultPsiToDocumentableTranslator.kt b/plugins/base/src/main/kotlin/translators/psi/DefaultPsiToDocumentableTranslator.kt
index be7b826b..d2fb0271 100644
--- a/plugins/base/src/main/kotlin/translators/psi/DefaultPsiToDocumentableTranslator.kt
+++ b/plugins/base/src/main/kotlin/translators/psi/DefaultPsiToDocumentableTranslator.kt
@@ -602,6 +602,15 @@ class DefaultPsiToDocumentableTranslator(
val psiClass = ((type as PsiImmediateClassType).parameters.single() as PsiClassReferenceType).resolve()
psiClass?.let { ClassValue(text ?: "", DRI.from(psiClass)) }
}
+ is PsiLiteralExpression -> toValue()
+ else -> StringValue(text ?: "")
+ }
+
+ private fun PsiLiteralExpression.toValue(): AnnotationParameterValue? = when (type) {
+ PsiType.INT -> (value as? Int)?.let { IntValue(it) }
+ PsiType.LONG -> (value as? Long)?.let { LongValue(it) }
+ PsiType.FLOAT -> (value as? Float)?.let { FloatValue(it) }
+ PsiType.DOUBLE -> (value as? Double)?.let { DoubleValue(it) }
else -> StringValue(text ?: "")
}