Deprecate JVM target 1.6
#KT-44650 Fixed
This commit is contained in:
+7
-1
@@ -71,7 +71,7 @@ class K2JVMCompilerArguments : CommonCompilerArguments() {
|
||||
@Argument(
|
||||
value = "-jvm-target",
|
||||
valueDescription = "<version>",
|
||||
description = "Target version of the generated JVM bytecode (1.6, 1.8, 9, 10, 11, 12, 13, 14 or 15), default is 1.8"
|
||||
description = "Target version of the generated JVM bytecode (1.6 (DEPRECATED), 1.8, 9, 10, 11, 12, 13, 14 or 15), default is 1.8"
|
||||
)
|
||||
var jvmTarget: String? by NullableStringFreezableVar(JvmTarget.DEFAULT.description)
|
||||
|
||||
@@ -448,6 +448,12 @@ class K2JVMCompilerArguments : CommonCompilerArguments() {
|
||||
)
|
||||
var enableJvmPreview: Boolean by FreezableVar(false)
|
||||
|
||||
@Argument(
|
||||
value = "-Xsuppress-deprecated-jvm-target-warning",
|
||||
description = "Suppress deprecation warning about deprecated JVM target versions"
|
||||
)
|
||||
var suppressDeprecatedJvmTargetWarning: Boolean by FreezableVar(false)
|
||||
|
||||
override fun configureAnalysisFlags(collector: MessageCollector): MutableMap<AnalysisFlag<*>, Any> {
|
||||
val result = super.configureAnalysisFlags(collector)
|
||||
result[JvmAnalysisFlags.strictMetadataVersionSemantics] = strictMetadataVersionSemantics
|
||||
|
||||
@@ -29,6 +29,12 @@ fun CompilerConfiguration.setupJvmSpecificArguments(arguments: K2JVMCompilerArgu
|
||||
val jvmTarget = JvmTarget.fromString(arguments.jvmTarget!!)
|
||||
if (jvmTarget != null) {
|
||||
put(JVMConfigurationKeys.JVM_TARGET, jvmTarget)
|
||||
if (jvmTarget == JvmTarget.JVM_1_6 && !arguments.suppressDeprecatedJvmTargetWarning) {
|
||||
messageCollector.report(
|
||||
STRONG_WARNING,
|
||||
"JVM target 1.6 is deprecated and will be removed in a future release. Please migrate to JVM target 1.8 or above"
|
||||
)
|
||||
}
|
||||
} else {
|
||||
messageCollector.report(
|
||||
ERROR, "Unknown JVM target version: ${arguments.jvmTarget}\n" +
|
||||
|
||||
Reference in New Issue
Block a user