JVM_IR indy-SAM conversions, 1st passing tests
KT-44278 KT-26060 KT-42621
This commit is contained in:
+9
@@ -362,6 +362,15 @@ class K2JVMCompilerArguments : CommonCompilerArguments() {
|
||||
)
|
||||
var stringConcat: String? by NullableStringFreezableVar(JvmStringConcat.INLINE.description)
|
||||
|
||||
@Argument(
|
||||
value = "-Xsam-conversions",
|
||||
valueDescription = "{class|indy}",
|
||||
description = """Select code generation scheme for SAM conversions.
|
||||
-Xsam-conversions=indy Generate SAM conversions using `invokedynamic` with `LambdaMetafactory.metafactory`. Requires `-jvm-target 8` or greater.
|
||||
-Xsam-conversions=class Generate SAM conversions as explicit classes"""
|
||||
)
|
||||
var samConversions: String? by NullableStringFreezableVar(JvmSamConversions.CLASS.description)
|
||||
|
||||
@Argument(
|
||||
value = "-Xklib",
|
||||
valueDescription = "<path>",
|
||||
|
||||
@@ -59,8 +59,28 @@ fun CompilerConfiguration.setupJvmSpecificArguments(arguments: K2JVMCompilerArgu
|
||||
}
|
||||
} else {
|
||||
messageCollector.report(
|
||||
ERROR, "Unknown -Xstring-concat mode: ${arguments.jvmTarget}\n" +
|
||||
"Supported versions: ${JvmStringConcat.values().joinToString { it.description }}"
|
||||
ERROR, "Unknown `-Xstring-concat` mode: ${arguments.stringConcat}\n" +
|
||||
"Supported modes: ${JvmStringConcat.values().joinToString { it.description }}"
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
if (arguments.samConversions != null) {
|
||||
val samConversions = JvmSamConversions.fromString(arguments.samConversions)
|
||||
if (samConversions != null) {
|
||||
put(JVMConfigurationKeys.SAM_CONVERSIONS, samConversions)
|
||||
if (jvmTarget < samConversions.minJvmTarget) {
|
||||
messageCollector.report(
|
||||
WARNING,
|
||||
"`-Xsam-conversions=${arguments.samConversions}` requires JVM target at least " +
|
||||
"${samConversions.minJvmTarget.description} and is ignored."
|
||||
)
|
||||
}
|
||||
} else {
|
||||
messageCollector.report(
|
||||
ERROR,
|
||||
"Unknown `-Xsam-conversions` argument: ${arguments.samConversions}\n" +
|
||||
"Supported arguments: ${JvmSamConversions.values().joinToString { it.description }}"
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user