aboutsummaryrefslogtreecommitdiff
path: root/plugins/kotlin-as-java/src/main/kotlin/jvmField.kt
diff options
context:
space:
mode:
Diffstat (limited to 'plugins/kotlin-as-java/src/main/kotlin/jvmField.kt')
-rw-r--r--plugins/kotlin-as-java/src/main/kotlin/jvmField.kt12
1 files changed, 12 insertions, 0 deletions
diff --git a/plugins/kotlin-as-java/src/main/kotlin/jvmField.kt b/plugins/kotlin-as-java/src/main/kotlin/jvmField.kt
new file mode 100644
index 00000000..9a66eb27
--- /dev/null
+++ b/plugins/kotlin-as-java/src/main/kotlin/jvmField.kt
@@ -0,0 +1,12 @@
+package org.jetbrains.dokka.kotlinAsJava
+
+import org.jetbrains.dokka.model.Annotations
+import org.jetbrains.dokka.model.Documentable
+import org.jetbrains.dokka.model.properties.WithExtraProperties
+import org.jetbrains.kotlin.utils.addToStdlib.firstNotNullResult
+
+internal fun WithExtraProperties<out Documentable>.jvmField(): Annotations.Annotation? =
+ extra[Annotations]?.directAnnotations?.entries?.firstNotNullResult { (_, annotations) -> annotations.jvmFieldAnnotation() }
+
+internal fun List<Annotations.Annotation>.jvmFieldAnnotation(): Annotations.Annotation? =
+ firstOrNull { it.dri.packageName == "kotlin.jvm" && it.dri.classNames == "JvmField" } \ No newline at end of file