diff options
6 files changed, 38 insertions, 4 deletions
diff --git a/core/api/core.api b/core/api/core.api index e8445608..91ea34d3 100644 --- a/core/api/core.api +++ b/core/api/core.api @@ -681,6 +681,18 @@ public final class org/jetbrains/dokka/model/ArrayValue : org/jetbrains/dokka/mo public fun toString ()Ljava/lang/String; } +public final class org/jetbrains/dokka/model/BooleanValue : org/jetbrains/dokka/model/LiteralValue { + public fun <init> (Z)V + public final fun component1 ()Z + public final fun copy (Z)Lorg/jetbrains/dokka/model/BooleanValue; + public static synthetic fun copy$default (Lorg/jetbrains/dokka/model/BooleanValue;ZILjava/lang/Object;)Lorg/jetbrains/dokka/model/BooleanValue; + public fun equals (Ljava/lang/Object;)Z + public final fun getValue ()Z + public fun hashCode ()I + public fun text ()Ljava/lang/String; + public fun toString ()Ljava/lang/String; +} + public abstract class org/jetbrains/dokka/model/Bound : org/jetbrains/dokka/model/Projection, org/jetbrains/dokka/model/AnnotationTarget { } @@ -1749,6 +1761,11 @@ public abstract class org/jetbrains/dokka/model/Modifier { public final fun getName ()Ljava/lang/String; } +public final class org/jetbrains/dokka/model/NullValue : org/jetbrains/dokka/model/LiteralValue { + public static final field INSTANCE Lorg/jetbrains/dokka/model/NullValue; + public fun text ()Ljava/lang/String; +} + public final class org/jetbrains/dokka/model/Nullable : org/jetbrains/dokka/model/Bound { public fun <init> (Lorg/jetbrains/dokka/model/Bound;)V public final fun component1 ()Lorg/jetbrains/dokka/model/Bound; diff --git a/core/src/main/kotlin/model/additionalExtras.kt b/core/src/main/kotlin/model/additionalExtras.kt index 9249b089..4f78e7af 100644 --- a/core/src/main/kotlin/model/additionalExtras.kt +++ b/core/src/main/kotlin/model/additionalExtras.kt @@ -88,6 +88,12 @@ data class FloatValue(val value: Float) : LiteralValue() { data class DoubleValue(val value: Double) : LiteralValue() { override fun text(): String = value.toString() } +object NullValue : LiteralValue() { + override fun text(): String = "null" +} +data class BooleanValue(val value: Boolean) : LiteralValue() { + override fun text(): String = value.toString() +} data class StringValue(val value: String) : LiteralValue() { override fun text(): String = value override fun toString(): String = value diff --git a/plugins/base/src/main/kotlin/translators/descriptors/DefaultDescriptorToDocumentableTranslator.kt b/plugins/base/src/main/kotlin/translators/descriptors/DefaultDescriptorToDocumentableTranslator.kt index 1870b8da..3ff8ffc3 100644 --- a/plugins/base/src/main/kotlin/translators/descriptors/DefaultDescriptorToDocumentableTranslator.kt +++ b/plugins/base/src/main/kotlin/translators/descriptors/DefaultDescriptorToDocumentableTranslator.kt @@ -75,6 +75,8 @@ 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 +import org.jetbrains.kotlin.resolve.constants.BooleanValue as ConstantsBooleanValue +import org.jetbrains.kotlin.resolve.constants.NullValue as ConstantsNullValue class DefaultDescriptorToDocumentableTranslator( context: DokkaContext @@ -975,6 +977,8 @@ private class DokkaDescriptorVisitor( is ConstantsULongValue -> LongValue(value) is ConstantsIntValue -> IntValue(value) is ConstantsLongValue -> LongValue(value) + is ConstantsBooleanValue -> BooleanValue(value) + is ConstantsNullValue -> NullValue 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 d2fb0271..878d5973 100644 --- a/plugins/base/src/main/kotlin/translators/psi/DefaultPsiToDocumentableTranslator.kt +++ b/plugins/base/src/main/kotlin/translators/psi/DefaultPsiToDocumentableTranslator.kt @@ -611,6 +611,8 @@ class DefaultPsiToDocumentableTranslator( PsiType.LONG -> (value as? Long)?.let { LongValue(it) } PsiType.FLOAT -> (value as? Float)?.let { FloatValue(it) } PsiType.DOUBLE -> (value as? Double)?.let { DoubleValue(it) } + PsiType.BOOLEAN -> (value as? Boolean)?.let { BooleanValue(it) } + PsiType.NULL -> NullValue else -> StringValue(text ?: "") } diff --git a/plugins/base/src/test/kotlin/content/annotations/ContentForAnnotationsTest.kt b/plugins/base/src/test/kotlin/content/annotations/ContentForAnnotationsTest.kt index 5ea792f0..c48ddedf 100644 --- a/plugins/base/src/test/kotlin/content/annotations/ContentForAnnotationsTest.kt +++ b/plugins/base/src/test/kotlin/content/annotations/ContentForAnnotationsTest.kt @@ -188,6 +188,7 @@ class ContentForAnnotationsTest : BaseAbstractTest() { | val ref: Reference = Reference(value = 1), | val reportedBy: Array<Reference>, | val showStopper: Boolean = false + | val previousReport: BugReport? |) { | enum class Status { | UNCONFIRMED, CONFIRMED, FIXED, NOTABUG @@ -205,7 +206,8 @@ class ContentForAnnotationsTest : BaseAbstractTest() { | ref = Reference(value = 2u), | reportedBy = [Reference(value = 2UL), Reference(value = 4L), | ReferenceReal(value = 4.9), ReferenceReal(value = 2f)], - | showStopper = true + | showStopper = true, + | previousReport = null |) |val ltint: Int = 5 """.trimIndent(), testConfiguration @@ -233,6 +235,8 @@ class ContentForAnnotationsTest : BaseAbstractTest() { expectedAnnotationValue("ReferenceReal", FloatValue(2f)) )) assertEquals(reportedByParam, annotationParams["reportedBy"]) + assertEquals(BooleanValue(true), annotationParams["showStopper"]) + assertEquals(NullValue, annotationParams["previousReport"]) } pagesTransformationStage = { module -> @@ -246,7 +250,8 @@ class ContentForAnnotationsTest : BaseAbstractTest() { "status", "ref", "reportedBy", - "showStopper" + "showStopper", + "previousReport" ) ), "", "", emptySet(), "val", "ltint", "Int", "5" ) diff --git a/plugins/javadoc/src/main/kotlin/org/jetbrains/dokka/javadoc/pages/htmlPreprocessors.kt b/plugins/javadoc/src/main/kotlin/org/jetbrains/dokka/javadoc/pages/htmlPreprocessors.kt index d6a15865..6bc0d9fd 100644 --- a/plugins/javadoc/src/main/kotlin/org/jetbrains/dokka/javadoc/pages/htmlPreprocessors.kt +++ b/plugins/javadoc/src/main/kotlin/org/jetbrains/dokka/javadoc/pages/htmlPreprocessors.kt @@ -5,7 +5,7 @@ import org.jetbrains.dokka.base.transformers.documentables.deprecatedAnnotation import org.jetbrains.dokka.base.transformers.documentables.isDeprecated import org.jetbrains.dokka.base.transformers.documentables.isException import org.jetbrains.dokka.model.Documentable -import org.jetbrains.dokka.model.StringValue +import org.jetbrains.dokka.model.BooleanValue import org.jetbrains.dokka.model.WithSupertypes import org.jetbrains.dokka.pages.* import org.jetbrains.dokka.transformers.pages.PageTransformer @@ -113,7 +113,7 @@ object DeprecatedPageCreator : PageTransformer { (this as? WithBrief)?.brief.orEmpty() ) getOrPut(deprecatedPageSection) { mutableSetOf() }.add(deprecatedNode) - if (deprecatedAnnotation?.params?.get("forRemoval") == StringValue("true")) { + if (deprecatedAnnotation?.params?.get("forRemoval") == BooleanValue(true)) { getOrPut(DeprecatedPageSection.DeprecatedForRemoval) { mutableSetOf() }.add(deprecatedNode) } } |