blob: 379855ea76cde9194858ecb15b1181c2f25a0c55 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
|
package org.jetbrains.dokka.base.transformers.documentables
import org.jetbrains.dokka.model.Annotations
import org.jetbrains.dokka.model.Documentable
import org.jetbrains.dokka.model.ExceptionInSupertypes
import org.jetbrains.dokka.model.properties.WithExtraProperties
val <T : Documentable> WithExtraProperties<T>.isException: Boolean
get() = extra[ExceptionInSupertypes] != null
val <T : Documentable> WithExtraProperties<T>.deprecatedAnnotation
get() = extra[Annotations]?.let { annotations ->
annotations.directAnnotations.values.flatten().firstOrNull {
it.isDeprecated()
}
}
/**
* @return true if [T] has [kotlin.Deprecated] or [java.lang.Deprecated]
* annotation for **any** source set
*/
fun <T : Documentable> WithExtraProperties<T>.isDeprecated() = 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")
|