Proofread -Xjvm-default description
This commit is contained in:
+22
-25
@@ -48,34 +48,31 @@ where advanced options include:
|
||||
* strict (experimental; treat as other supported nullability annotations)
|
||||
* warn (report a warning)
|
||||
-Xjvm-default={all|all-compatibility|disable|enable|compatibility}
|
||||
Emit JVM default methods for interface declarations with bodies.
|
||||
-Xjvm-default=all Generate JVM default methods for all interface declarations with bodies in module.
|
||||
Do not generate DefaultImpls stubs for such declarations (that is default behaviour of compiler in 'disable' mode).
|
||||
If interface inherits such methods from interface compiled in 'disable' scheme
|
||||
then implicit DefaultImpls stubs would be generated as there are no default method for it.
|
||||
BREAKS BINARY COMPATIBILITY if some client code relies on the presence of
|
||||
DefaultImpls classes. Also prohibits the produced binaries to be read by Kotlin
|
||||
compilers earlier than 1.4.
|
||||
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 the module.
|
||||
Do not generate DefaultImpls stubs for interface declarations with bodies, which are generated by default
|
||||
in the 'disable' mode. If interface inherits a method with body from an interface compiled in the 'disable'
|
||||
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 DefaultImpls classes.
|
||||
Note that if interface delegation is used, all interface methods are delegated.
|
||||
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.
|
||||
Compatibility stubs could be useful for library and runtime authors
|
||||
to keep backward binary compatibility for existing client 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.
|
||||
In that sense client might be incompatible with previous library versions that REQUIRE PROPER LIBRARY VERSIONING.
|
||||
In case of inheritance from a Kotlin interface compiled in the old scheme
|
||||
(DefaultImpls, no default methods), the implicit stubs in DefaultImpls
|
||||
will delegate to the DefaultImpls method of the superinterface.
|
||||
Otherwise the compatibility stubs in DefaultImpls would invoke the default method on the interface via special accessor in it,
|
||||
with standard JVM runtime resolution semantics.
|
||||
Perform additional compatibility checks for classes in case of implicit specialized override
|
||||
presence in 'disable' scheme (See KT-39603 for more details)
|
||||
-Xjvm-default=disable Default behaviour. Do not generate JVM default methods and prohibit @JvmDefault annotation usage.
|
||||
-Xjvm-default=enable Deprecated. Allow usages of @JvmDefault; only generate the default method
|
||||
for annotated method in the interface
|
||||
(annotating an existing method can break binary compatibility)
|
||||
-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 to keep backward binary compatibility
|
||||
for existing clients compiled against previous library versions.
|
||||
'all' and 'all-compatibility' modes are changing the library ABI surface that will be used by clients after
|
||||
the recompilation of the library. In that sense, clients might be incompatible with previous library
|
||||
versions. This usually means that proper library versioning is required, e.g. major version increase in SemVer.
|
||||
In case of inheritance from a Kotlin interface compiled in 'all' or 'all-compatibility' modes, DefaultImpls
|
||||
compatibility stubs will invoke the default method of the interface with standard JVM runtime resolution semantics.
|
||||
Perform additional compatibility checks for classes inheriting generic interfaces where in some cases
|
||||
additional implicit method with specialized signatures was generated in the 'disable' mode:
|
||||
unlike in the 'disable' mode, the compiler will report an error if such method is not overridden explicitly
|
||||
and the class is not annotated with @JvmDefaultWithoutCompatibility (see KT-39603 for more details).
|
||||
-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 for annotated method
|
||||
in the interface (annotating an existing method can break binary compatibility).
|
||||
-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
|
||||
Allow inheritance from 'all*' modes for 'disable' one
|
||||
-Xklib=<path> Paths to cross-platform libraries in .klib format
|
||||
|
||||
Reference in New Issue
Block a user