aboutsummaryrefslogtreecommitdiff
path: root/plugins/base/src/main/kotlin
diff options
context:
space:
mode:
authorBłażej Kardyś <bkardys@virtuslab.com>2020-08-03 03:57:48 +0200
committerPaweł Marks <Kordyjan@users.noreply.github.com>2020-08-21 12:16:24 +0200
commitc2b02c1fc17b839075b7cb6fd42498a519473fae (patch)
tree1de744003a37fbf361f799429ec9fb8887382037 /plugins/base/src/main/kotlin
parent69d16856abcc68b31d298e6a62a7a58106de69c9 (diff)
downloaddokka-c2b02c1fc17b839075b7cb6fd42498a519473fae.tar.gz
dokka-c2b02c1fc17b839075b7cb6fd42498a519473fae.tar.bz2
dokka-c2b02c1fc17b839075b7cb6fd42498a519473fae.zip
Deprecated elements page for javadoc format
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