@@ -53,27 +53,32 @@ where advanced options include:
53
53
* warn (report a warning)
54
54
-Xjvm-default={all|all-compatibility|disable|enable|compatibility}
55
55
Emit JVM default methods for interface declarations with bodies.
56
- -Xjvm-default=all-compatibility Generate both a default method in the interface, and a compatibility accessor
57
- in the DefaultImpls class.
58
- In case of inheritance from a Kotlin interface compiled in the old scheme
59
- (DefaultImpls, no default methods), the compatibility accessor in DefaultImpls
60
- will delegate to the DefaultImpls method of the superinterface. Otherwise the
61
- compatibility accessor will invoke the default method on the interface, with
62
- standard JVM runtime resolution semantics.
63
- Note that if interface delegation is used, all interface methods are delegated.
64
- The only exception are methods annotated with the deprecated @JvmDefault annotation.
65
- -Xjvm-default=all Generate default methods for all interface declarations with bodies.
66
- Do not generate DefaultImpls classes at all.
56
+ -Xjvm-default=all Generate JVM default methods for all interface declarations with bodies in module.
57
+ Do not generate DefaultImpls stubs for such declarations (that is default behaviour of compiler in 'disable' mode).
58
+ If interface inherits such methods from interface compiled in 'disable' scheme
59
+ then implicit DefaultImpls stubs would be generated as there are no default method for it.
67
60
BREAKS BINARY COMPATIBILITY if some client code relies on the presence of
68
61
DefaultImpls classes. Also prohibits the produced binaries to be read by Kotlin
69
62
compilers earlier than 1.4.
70
63
Note that if interface delegation is used, all interface methods are delegated.
71
64
The only exception are methods annotated with the deprecated @JvmDefault annotation.
72
- -Xjvm-default=disable Do not generate JVM default methods and prohibit @JvmDefault annotation usage.
73
- -Xjvm-default=enable Allow usages of @JvmDefault; only generate the default method
65
+ -Xjvm-default=all-compatibility In addition to `all` mode generate compatibility stubs in the DefaultImpls classes.
66
+ Compatibility stubs could be useful for library and runtime authors
67
+ to keep backward binary compatibility for existing client compiled against previous library versions.
68
+ New 'all' and 'all-compatibility' modes are changing library ABI surface that will be used by client after their recompilation.
69
+ In that sense client might be incompatible with previous library versions that REQUIRE PROPER LIBRARY VERSIONING.
70
+ In case of inheritance from a Kotlin interface compiled in the old scheme
71
+ (DefaultImpls, no default methods), the implicit stubs in DefaultImpls
72
+ will delegate to the DefaultImpls method of the superinterface.
73
+ Otherwise the compatibility stubs in DefaultImpls would invoke the default method on the interface via special accessor in it,
74
+ with standard JVM runtime resolution semantics.
75
+ Perform additional compatibility checks for classes in case of implicit specialized override
76
+ presence in 'disable' scheme (See KT-39603 for more details)
77
+ -Xjvm-default=disable Default behaviour. Do not generate JVM default methods and prohibit @JvmDefault annotation usage.
78
+ -Xjvm-default=enable Deprecated. Allow usages of @JvmDefault; only generate the default method
74
79
for annotated method in the interface
75
80
(annotating an existing method can break binary compatibility)
76
- -Xjvm-default=compatibility Allow usages of @JvmDefault; generate a compatibility accessor
81
+ -Xjvm-default=compatibility Deprecated. Allow usages of @JvmDefault; generate a compatibility accessor
77
82
in the 'DefaultImpls' class in addition to the default interface method
78
83
-Xjvm-default-allow-non-default-inheritance
79
84
Allow inheritance from 'all*' modes for 'disable' one
0 commit comments