Add check for bytecode target when @JvmRecord is used
^KT-43677 In Progress
This commit is contained in:
@@ -67,9 +67,21 @@ fun CompilerConfiguration.setupJvmSpecificArguments(arguments: K2JVMCompilerArgu
|
||||
}
|
||||
}
|
||||
|
||||
if (languageVersionSettings.supportsFeature(LanguageFeature.JvmRecordSupport) && !jvmTarget.isRecordsAllowed()) {
|
||||
messageCollector.report(
|
||||
ERROR,
|
||||
"-XXLanguage:+${LanguageFeature.JvmRecordSupport} feature is only supported with JVM target ${JvmTarget.JVM_15_PREVIEW.description} or later"
|
||||
)
|
||||
}
|
||||
|
||||
addAll(JVMConfigurationKeys.ADDITIONAL_JAVA_MODULES, arguments.additionalJavaModules?.asList())
|
||||
}
|
||||
|
||||
private fun JvmTarget.isRecordsAllowed(): Boolean {
|
||||
if (majorVersion < JvmTarget.JVM_15_PREVIEW.majorVersion) return false
|
||||
return isPreview || majorVersion > JvmTarget.JVM_15_PREVIEW.majorVersion
|
||||
}
|
||||
|
||||
fun CompilerConfiguration.configureJdkHome(arguments: K2JVMCompilerArguments): Boolean {
|
||||
|
||||
val messageCollector = getNotNull(CLIConfigurationKeys.MESSAGE_COLLECTOR_KEY)
|
||||
|
||||
Reference in New Issue
Block a user