Generate 'DefaultImpls' for jvm 8 target only within compiler option
This commit is contained in:
+3
@@ -98,6 +98,9 @@ public class K2JVMCompilerArguments extends CommonCompilerArguments {
|
||||
@Argument(value = "Xsingle-module", description = "Combine modules for source files and binary dependencies into a single module")
|
||||
public boolean singleModule;
|
||||
|
||||
@Argument(value = "Xinterface-compatibility", description = "Generate DefaultImpls classes for interfaces in JVM target bytecode version 1.8 for binary compatibility with 1.6")
|
||||
public boolean interfaceCompatibility;
|
||||
|
||||
// Paths to output directories for friend modules.
|
||||
public String[] friendPaths;
|
||||
|
||||
|
||||
@@ -139,6 +139,17 @@ class K2JVMCompiler : CLICompiler<K2JVMCompilerArguments>() {
|
||||
}
|
||||
}
|
||||
|
||||
if (arguments.interfaceCompatibility) {
|
||||
val target = configuration.get(JVMConfigurationKeys.JVM_TARGET)
|
||||
if (target != JvmTarget.JVM_1_8) {
|
||||
val errorMessage = "The -Xinterface-compatibility option has effect only for JVM target bytecode version 1.8."
|
||||
messageCollector.report(CompilerMessageSeverity.WARNING, errorMessage, CompilerMessageLocation.NO_LOCATION)
|
||||
}
|
||||
else {
|
||||
configuration.put(JVMConfigurationKeys.INTERFACE_COMPATIBILITY, true)
|
||||
}
|
||||
}
|
||||
|
||||
putAdvancedOptions(configuration, arguments)
|
||||
|
||||
messageCollector.report(CompilerMessageSeverity.LOGGING, "Configuring the compilation environment", CompilerMessageLocation.NO_LOCATION)
|
||||
|
||||
Reference in New Issue
Block a user