From 58becffb1f45d26f30f79422e22eb17199c83f18 Mon Sep 17 00:00:00 2001 From: Artem Zinnatullin Date: Tue, 31 Jul 2018 11:46:29 -0700 Subject: [PATCH] Add documentation for @JvmSynthetic --- .../kotlin/jvm/annotations/JvmPlatformAnnotations.kt | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/libraries/stdlib/jvm/runtime/kotlin/jvm/annotations/JvmPlatformAnnotations.kt b/libraries/stdlib/jvm/runtime/kotlin/jvm/annotations/JvmPlatformAnnotations.kt index 8def18df7ba..58b304a8054 100644 --- a/libraries/stdlib/jvm/runtime/kotlin/jvm/annotations/JvmPlatformAnnotations.kt +++ b/libraries/stdlib/jvm/runtime/kotlin/jvm/annotations/JvmPlatformAnnotations.kt @@ -65,6 +65,15 @@ public actual annotation class JvmMultifileClass @SinceKotlin("1.2") internal annotation class JvmPackageName(val name: String) +/** + * Sets `ACC_SYNTHETIC` flag on the annotated target in the Java bytecode. + * + * Synthetic targets become inaccessible for Java sources at compile time while still being accessible for Kotlin sources. + * Marking target as synthetic is a binary compatible change, already compiled Java code will be able to access such target. + * + * This annotation is intended for *rare cases* when API designer needs to hide Kotlin-specific target from Java API + * while keeping it a part of Kotlin API so the resulting API is idiomatic for both languages. + */ @Target(AnnotationTarget.FUNCTION, AnnotationTarget.PROPERTY_GETTER, AnnotationTarget.PROPERTY_SETTER, AnnotationTarget.FIELD) @Retention(AnnotationRetention.SOURCE) public annotation class JvmSynthetic