Proofread -Xjvm-default description

This commit is contained in:
Alexander Udalov
2021-11-20 19:47:51 +01:00
parent 874b442a13
commit 40162dbf89
2 changed files with 44 additions and 50 deletions
@@ -305,34 +305,31 @@ class K2JVMCompilerArguments : CommonCompilerArguments() {
@Argument( @Argument(
value = "-Xjvm-default", value = "-Xjvm-default",
valueDescription = "{all|all-compatibility|disable|enable|compatibility}", valueDescription = "{all|all-compatibility|disable|enable|compatibility}",
description = """Emit JVM default methods for interface declarations with bodies. description = """Emit JVM default methods for interface declarations with bodies. Default is 'disable'.
-Xjvm-default=all Generate JVM default methods for all interface declarations with bodies in module. -Xjvm-default=all Generate JVM default methods for all interface declarations with bodies in the module.
Do not generate DefaultImpls stubs for such declarations (that is default behaviour of compiler in 'disable' mode). Do not generate DefaultImpls stubs for interface declarations with bodies, which are generated by default
If interface inherits such methods from interface compiled in 'disable' scheme in the 'disable' mode. If interface inherits a method with body from an interface compiled in the 'disable'
then implicit DefaultImpls stubs would be generated as there are no default method for it. mode and doesn't override it, then a DefaultImpls stub will be generated for it.
BREAKS BINARY COMPATIBILITY if some client code relies on the presence of BREAKS BINARY COMPATIBILITY if some client code relies on the presence of DefaultImpls classes.
DefaultImpls classes. Also prohibits the produced binaries to be read by Kotlin
compilers earlier than 1.4.
Note that if interface delegation is used, all interface methods are delegated. Note that if interface delegation is used, all interface methods are delegated.
The only exception are methods annotated with the deprecated @JvmDefault annotation. The only exception are methods annotated with the deprecated @JvmDefault annotation.
-Xjvm-default=all-compatibility In addition to `all` mode generate compatibility stubs in the DefaultImpls classes. -Xjvm-default=all-compatibility In addition to the 'all' mode, generate compatibility stubs in the DefaultImpls classes.
Compatibility stubs could be useful for library and runtime authors Compatibility stubs could be useful for library and runtime authors to keep backward binary compatibility
to keep backward binary compatibility for existing client compiled against previous library versions. for existing clients compiled against previous library versions.
New 'all' and 'all-compatibility' modes are changing library ABI surface that will be used by client after their recompilation. 'all' and 'all-compatibility' modes are changing the library ABI surface that will be used by clients after
In that sense client might be incompatible with previous library versions that REQUIRE PROPER LIBRARY VERSIONING. the recompilation of the library. In that sense, clients might be incompatible with previous library
In case of inheritance from a Kotlin interface compiled in the old scheme versions. This usually means that proper library versioning is required, e.g. major version increase in SemVer.
(DefaultImpls, no default methods), the implicit stubs in DefaultImpls In case of inheritance from a Kotlin interface compiled in 'all' or 'all-compatibility' modes, DefaultImpls
will delegate to the DefaultImpls method of the superinterface. compatibility stubs will invoke the default method of the interface with standard JVM runtime resolution semantics.
Otherwise the compatibility stubs in DefaultImpls would invoke the default method on the interface via special accessor in it, Perform additional compatibility checks for classes inheriting generic interfaces where in some cases
with standard JVM runtime resolution semantics. additional implicit method with specialized signatures was generated in the 'disable' mode:
Perform additional compatibility checks for classes in case of implicit specialized override unlike in the 'disable' mode, the compiler will report an error if such method is not overridden explicitly
presence in 'disable' scheme (See KT-39603 for more details) and the class is not annotated with @JvmDefaultWithoutCompatibility (see KT-39603 for more details).
-Xjvm-default=disable Default behaviour. Do not generate JVM default methods and prohibit @JvmDefault annotation usage. -Xjvm-default=disable Default behavior. Do not generate JVM default methods and prohibit @JvmDefault annotation usage.
-Xjvm-default=enable Deprecated. Allow usages of @JvmDefault; only generate the default method -Xjvm-default=enable Deprecated. Allow usages of @JvmDefault; only generate the default method for annotated method
for annotated method in the interface in the interface (annotating an existing method can break binary compatibility).
(annotating an existing method can break binary compatibility)
-Xjvm-default=compatibility Deprecated. Allow usages of @JvmDefault; generate a compatibility accessor -Xjvm-default=compatibility Deprecated. Allow usages of @JvmDefault; generate a compatibility accessor
in the 'DefaultImpls' class in addition to the default interface method""" in the DefaultImpls class in addition to the default interface method."""
) )
var jvmDefault: String by FreezableVar(JvmDefaultMode.DEFAULT.description) var jvmDefault: String by FreezableVar(JvmDefaultMode.DEFAULT.description)
+22 -25
View File
@@ -48,34 +48,31 @@ where advanced options include:
* strict (experimental; treat as other supported nullability annotations) * strict (experimental; treat as other supported nullability annotations)
* warn (report a warning) * warn (report a warning)
-Xjvm-default={all|all-compatibility|disable|enable|compatibility} -Xjvm-default={all|all-compatibility|disable|enable|compatibility}
Emit JVM default methods for interface declarations with bodies. Emit JVM default methods for interface declarations with bodies. Default is 'disable'.
-Xjvm-default=all Generate JVM default methods for all interface declarations with bodies in module. -Xjvm-default=all Generate JVM default methods for all interface declarations with bodies in the module.
Do not generate DefaultImpls stubs for such declarations (that is default behaviour of compiler in 'disable' mode). Do not generate DefaultImpls stubs for interface declarations with bodies, which are generated by default
If interface inherits such methods from interface compiled in 'disable' scheme in the 'disable' mode. If interface inherits a method with body from an interface compiled in the 'disable'
then implicit DefaultImpls stubs would be generated as there are no default method for it. mode and doesn't override it, then a DefaultImpls stub will be generated for it.
BREAKS BINARY COMPATIBILITY if some client code relies on the presence of BREAKS BINARY COMPATIBILITY if some client code relies on the presence of DefaultImpls classes.
DefaultImpls classes. Also prohibits the produced binaries to be read by Kotlin
compilers earlier than 1.4.
Note that if interface delegation is used, all interface methods are delegated. Note that if interface delegation is used, all interface methods are delegated.
The only exception are methods annotated with the deprecated @JvmDefault annotation. The only exception are methods annotated with the deprecated @JvmDefault annotation.
-Xjvm-default=all-compatibility In addition to `all` mode generate compatibility stubs in the DefaultImpls classes. -Xjvm-default=all-compatibility In addition to the 'all' mode, generate compatibility stubs in the DefaultImpls classes.
Compatibility stubs could be useful for library and runtime authors Compatibility stubs could be useful for library and runtime authors to keep backward binary compatibility
to keep backward binary compatibility for existing client compiled against previous library versions. for existing clients compiled against previous library versions.
New 'all' and 'all-compatibility' modes are changing library ABI surface that will be used by client after their recompilation. 'all' and 'all-compatibility' modes are changing the library ABI surface that will be used by clients after
In that sense client might be incompatible with previous library versions that REQUIRE PROPER LIBRARY VERSIONING. the recompilation of the library. In that sense, clients might be incompatible with previous library
In case of inheritance from a Kotlin interface compiled in the old scheme versions. This usually means that proper library versioning is required, e.g. major version increase in SemVer.
(DefaultImpls, no default methods), the implicit stubs in DefaultImpls In case of inheritance from a Kotlin interface compiled in 'all' or 'all-compatibility' modes, DefaultImpls
will delegate to the DefaultImpls method of the superinterface. compatibility stubs will invoke the default method of the interface with standard JVM runtime resolution semantics.
Otherwise the compatibility stubs in DefaultImpls would invoke the default method on the interface via special accessor in it, Perform additional compatibility checks for classes inheriting generic interfaces where in some cases
with standard JVM runtime resolution semantics. additional implicit method with specialized signatures was generated in the 'disable' mode:
Perform additional compatibility checks for classes in case of implicit specialized override unlike in the 'disable' mode, the compiler will report an error if such method is not overridden explicitly
presence in 'disable' scheme (See KT-39603 for more details) and the class is not annotated with @JvmDefaultWithoutCompatibility (see KT-39603 for more details).
-Xjvm-default=disable Default behaviour. Do not generate JVM default methods and prohibit @JvmDefault annotation usage. -Xjvm-default=disable Default behavior. Do not generate JVM default methods and prohibit @JvmDefault annotation usage.
-Xjvm-default=enable Deprecated. Allow usages of @JvmDefault; only generate the default method -Xjvm-default=enable Deprecated. Allow usages of @JvmDefault; only generate the default method for annotated method
for annotated method in the interface in the interface (annotating an existing method can break binary compatibility).
(annotating an existing method can break binary compatibility)
-Xjvm-default=compatibility Deprecated. Allow usages of @JvmDefault; generate a compatibility accessor -Xjvm-default=compatibility Deprecated. Allow usages of @JvmDefault; generate a compatibility accessor
in the 'DefaultImpls' class in addition to the default interface method in the DefaultImpls class in addition to the default interface method.
-Xjvm-default-allow-non-default-inheritance -Xjvm-default-allow-non-default-inheritance
Allow inheritance from 'all*' modes for 'disable' one Allow inheritance from 'all*' modes for 'disable' one
-Xklib=<path> Paths to cross-platform libraries in .klib format -Xklib=<path> Paths to cross-platform libraries in .klib format