Add JvmDefaultWithoutCompatibility annotation

This commit is contained in:
Mikhail Bogdanov
2020-06-08 09:06:10 +02:00
parent a98ad79d86
commit 477cca3c99
16 changed files with 207 additions and 6 deletions
@@ -32,3 +32,18 @@ import kotlin.internal.RequireKotlinVersionKind
@RequireKotlin("1.2.40", versionKind = RequireKotlinVersionKind.COMPILER_VERSION)
@Target(AnnotationTarget.FUNCTION, AnnotationTarget.PROPERTY)
annotation class JvmDefault
/**
* Prevents the compiler from generating compatibility accessors for the annotated class or interface, and suppresses
* any related compatibility warnings. In other words, this annotation makes the compiler generate the annotated class
* or interface in the `-Xjvm-default=all` mode, where only JVM default methods are generated, without `DefaultImpls`.
*
* Annotating an existing class with this annotation is a binary incompatible change. Therefore this annotation makes
* the most sense for _new_ classes in libraries which opted into the compatibility mode.
*
* Used only with `-Xjvm-default=compatibility|all-compatibility`.
*/
@SinceKotlin("1.4")
@RequireKotlin("1.4", versionKind = RequireKotlinVersionKind.COMPILER_VERSION)
@Target(AnnotationTarget.CLASS)
annotation class JvmDefaultWithoutCompatibility