diff options
Diffstat (limited to 'plugins/base/src/main')
3 files changed, 22 insertions, 1 deletions
diff --git a/plugins/base/src/main/kotlin/signatures/JvmSignatureUtils.kt b/plugins/base/src/main/kotlin/signatures/JvmSignatureUtils.kt index a5aa6879..f83eb4d8 100644 --- a/plugins/base/src/main/kotlin/signatures/JvmSignatureUtils.kt +++ b/plugins/base/src/main/kotlin/signatures/JvmSignatureUtils.kt @@ -104,7 +104,7 @@ interface JvmSignatureUtils { } is EnumValue -> link(a.enumName, a.enumDri) is ClassValue -> link(a.className + classExtension, a.classDRI) - is StringValue -> group(styles = setOf(TextStyle.Breakable)) { text(a.value) } + is LiteralValue -> group(styles = setOf(TextStyle.Breakable)) { text(a.text()) } } fun PageContentBuilder.DocumentableContentBuilder.annotationsBlockWithIgnored( diff --git a/plugins/base/src/main/kotlin/translators/descriptors/DefaultDescriptorToDocumentableTranslator.kt b/plugins/base/src/main/kotlin/translators/descriptors/DefaultDescriptorToDocumentableTranslator.kt index 8bb8b527..1870b8da 100644 --- a/plugins/base/src/main/kotlin/translators/descriptors/DefaultDescriptorToDocumentableTranslator.kt +++ b/plugins/base/src/main/kotlin/translators/descriptors/DefaultDescriptorToDocumentableTranslator.kt @@ -69,6 +69,12 @@ import org.jetbrains.kotlin.resolve.constants.AnnotationValue as ConstantsAnnota import org.jetbrains.kotlin.resolve.constants.ArrayValue as ConstantsArrayValue import org.jetbrains.kotlin.resolve.constants.EnumValue as ConstantsEnumValue import org.jetbrains.kotlin.resolve.constants.KClassValue as ConstantsKtClassValue +import org.jetbrains.kotlin.resolve.constants.DoubleValue as ConstantsDoubleValue +import org.jetbrains.kotlin.resolve.constants.FloatValue as ConstantsFloatValue +import org.jetbrains.kotlin.resolve.constants.IntValue as ConstantsIntValue +import org.jetbrains.kotlin.resolve.constants.LongValue as ConstantsLongValue +import org.jetbrains.kotlin.resolve.constants.UIntValue as ConstantsUIntValue +import org.jetbrains.kotlin.resolve.constants.ULongValue as ConstantsULongValue class DefaultDescriptorToDocumentableTranslator( context: DokkaContext @@ -963,6 +969,12 @@ private class DokkaDescriptorVisitor( ) } } + is ConstantsFloatValue -> FloatValue(value) + is ConstantsDoubleValue -> DoubleValue(value) + is ConstantsUIntValue -> IntValue(value) + is ConstantsULongValue -> LongValue(value) + is ConstantsIntValue -> IntValue(value) + is ConstantsLongValue -> LongValue(value) else -> StringValue(unquotedValue(toString())) } 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 ?: "") } |