JvmDefault: remove -Xjvm-default modes "enable" and "compatibility"
#KT-54746
This commit is contained in:
committed by
Space Team
parent
e0b5ae7781
commit
a0790047f7
+3
-9
@@ -466,7 +466,7 @@ class K2JVMCompilerArguments : CommonCompilerArguments() {
|
||||
|
||||
@Argument(
|
||||
value = "-Xjvm-default",
|
||||
valueDescription = "{all|all-compatibility|disable|enable|compatibility}",
|
||||
valueDescription = "{all|all-compatibility|disable}",
|
||||
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 the module.
|
||||
Do not generate DefaultImpls stubs for interface declarations with bodies, which are generated by default
|
||||
@@ -474,7 +474,6 @@ class K2JVMCompilerArguments : CommonCompilerArguments() {
|
||||
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 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.
|
||||
@@ -487,11 +486,7 @@ class K2JVMCompilerArguments : CommonCompilerArguments() {
|
||||
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."""
|
||||
-Xjvm-default=disable Default behavior. Do not generate JVM default methods."""
|
||||
)
|
||||
var jvmDefault: String = JvmDefaultMode.DEFAULT.description
|
||||
set(value) {
|
||||
@@ -871,8 +866,7 @@ Also sets `-jvm-target` value equal to the selected JDK version"""
|
||||
result[JvmAnalysisFlags.jvmDefaultMode] = it
|
||||
} ?: collector.report(
|
||||
CompilerMessageSeverity.ERROR,
|
||||
"Unknown @JvmDefault mode: $jvmDefault, " +
|
||||
"supported modes: ${JvmDefaultMode.values().map { it.description }}"
|
||||
"Unknown -Xjvm-default mode: $jvmDefault, supported modes: ${JvmDefaultMode.values().map { it.description }}"
|
||||
)
|
||||
result[JvmAnalysisFlags.inheritMultifileParts] = inheritMultifileParts
|
||||
result[JvmAnalysisFlags.sanitizeParentheses] = sanitizeParentheses
|
||||
|
||||
Reference in New Issue
Block a user