aboutsummaryrefslogtreecommitdiff
path: root/plugins/base/src/main/kotlin
diff options
context:
space:
mode:
Diffstat (limited to 'plugins/base/src/main/kotlin')
-rw-r--r--plugins/base/src/main/kotlin/transformers/documentables/DeprecatedDocumentableFilterTransformer.kt6
-rw-r--r--plugins/base/src/main/kotlin/transformers/documentables/utils.kt16
2 files changed, 16 insertions, 6 deletions
diff --git a/plugins/base/src/main/kotlin/transformers/documentables/DeprecatedDocumentableFilterTransformer.kt b/plugins/base/src/main/kotlin/transformers/documentables/DeprecatedDocumentableFilterTransformer.kt
index 109aa640..66156832 100644
--- a/plugins/base/src/main/kotlin/transformers/documentables/DeprecatedDocumentableFilterTransformer.kt
+++ b/plugins/base/src/main/kotlin/transformers/documentables/DeprecatedDocumentableFilterTransformer.kt
@@ -28,12 +28,6 @@ class DeprecatedDocumentableFilterTransformer(val context: DokkaContext) : PreMe
}?.skipDeprecated
?: globalOptions.skipDeprecated
- fun T.isDeprecated() = extra[Annotations]?.let { annotations ->
- annotations.content.values.flatten().any {
- it.dri.toString() == "kotlin/Deprecated///PointingToDeclaration/"
- }
- } ?: false
-
return !(condition && this.isDeprecated())
}
diff --git a/plugins/base/src/main/kotlin/transformers/documentables/utils.kt b/plugins/base/src/main/kotlin/transformers/documentables/utils.kt
new file mode 100644
index 00000000..a8f13ad8
--- /dev/null
+++ b/plugins/base/src/main/kotlin/transformers/documentables/utils.kt
@@ -0,0 +1,16 @@
+package org.jetbrains.dokka.base.transformers.documentables
+
+import org.jetbrains.dokka.model.Annotations
+import org.jetbrains.dokka.model.Documentable
+import org.jetbrains.dokka.model.properties.WithExtraProperties
+
+fun <T> T.isDeprecated() where T : WithExtraProperties<out Documentable> =
+ deprecatedAnnotation != null
+
+val <T> T.deprecatedAnnotation where T : WithExtraProperties<out Documentable>
+ get() = extra[Annotations]?.let { annotations ->
+ annotations.content.values.flatten().firstOrNull {
+ it.dri.toString() == "kotlin/Deprecated///PointingToDeclaration/" ||
+ it.dri.toString() == "java.lang/Deprecated///PointingToDeclaration/"
+ }
+ } \ No newline at end of file