aboutsummaryrefslogtreecommitdiff
path: root/plugins/base/src/main/kotlin/transformers/documentables
diff options
context:
space:
mode:
Diffstat (limited to 'plugins/base/src/main/kotlin/transformers/documentables')
-rw-r--r--plugins/base/src/main/kotlin/transformers/documentables/utils.kt22
1 files changed, 16 insertions, 6 deletions
diff --git a/plugins/base/src/main/kotlin/transformers/documentables/utils.kt b/plugins/base/src/main/kotlin/transformers/documentables/utils.kt
index 2a5fbc11..079cebea 100644
--- a/plugins/base/src/main/kotlin/transformers/documentables/utils.kt
+++ b/plugins/base/src/main/kotlin/transformers/documentables/utils.kt
@@ -5,16 +5,26 @@ import org.jetbrains.dokka.model.Documentable
import org.jetbrains.dokka.model.ExceptionInSupertypes
import org.jetbrains.dokka.model.properties.WithExtraProperties
-fun <T> T.isDeprecated() where T : WithExtraProperties<out Documentable> =
- deprecatedAnnotation != null
+val <T : WithExtraProperties<out Documentable>> T.isException: Boolean
+ get() = extra[ExceptionInSupertypes] != null
+
val <T> T.deprecatedAnnotation where T : WithExtraProperties<out Documentable>
get() = extra[Annotations]?.let { annotations ->
annotations.directAnnotations.values.flatten().firstOrNull {
- it.dri.toString() == "kotlin/Deprecated///PointingToDeclaration/" ||
- it.dri.toString() == "java.lang/Deprecated///PointingToDeclaration/"
+ it.isDeprecated()
}
}
-val <T : WithExtraProperties<out Documentable>> T.isException: Boolean
- get() = extra[ExceptionInSupertypes] != null \ No newline at end of file
+/**
+ * @return true if [T] has [kotlin.Deprecated] or [java.lang.Deprecated]
+ * annotation for **any** source set
+ */
+fun <T> T.isDeprecated() where T : WithExtraProperties<out Documentable> = deprecatedAnnotation != null
+
+/**
+ * @return true for [kotlin.Deprecated] and [java.lang.Deprecated]
+ */
+fun Annotations.Annotation.isDeprecated() =
+ (this.dri.packageName == "kotlin" && this.dri.classNames == "Deprecated") ||
+ (this.dri.packageName == "java.lang" && this.dri.classNames == "Deprecated")