Remove hack with targets. Add target for most recent jdk

This commit is contained in:
Mikhael Bogdanov
2019-05-15 11:59:29 +02:00
parent a53fa0dfbf
commit 812b766894
4 changed files with 40 additions and 32 deletions
@@ -623,12 +623,22 @@ public abstract class CodegenTestCase extends KtUsefulTestCase {
}
private static void setCustomDefaultJvmTarget(CompilerConfiguration configuration) {
JvmTarget target = configuration.get(JVMConfigurationKeys.JVM_TARGET);
if (target == null && DEFAULT_JVM_TARGET != null) {
JvmTarget value = JvmTarget.fromString(DEFAULT_JVM_TARGET);
assert value != null : "Can't construct JvmTarget for " + DEFAULT_JVM_TARGET;
configuration.put(JVMConfigurationKeys.JVM_TARGET, value);
protected void setCustomDefaultJvmTarget(CompilerConfiguration configuration) {
if (DEFAULT_JVM_TARGET != null) {
JvmTarget customDefaultTarget = JvmTarget.fromString(DEFAULT_JVM_TARGET);
assert customDefaultTarget != null : "Can't construct JvmTarget for " + DEFAULT_JVM_TARGET;
JvmTarget originalTarget = configuration.get(JVMConfigurationKeys.JVM_TARGET);
if (originalTarget == null || customDefaultTarget.getBytecodeVersion() > originalTarget.getBytecodeVersion()) {
// It's not safe to substitute target in general
// cause it can affect generated bytecode and original behaviour should be tested somehow.
// Original behaviour testing is perfomed by
//
// codegenTest(target = 6, jvm = "Last", jdk = mostRecentJdk)
// codegenTest(target = 8, jvm = "Last", jdk = mostRecentJdk)
//
// in compiler/tests-different-jdk/build.gradle.kts
configuration.put(JVMConfigurationKeys.JVM_TARGET, customDefaultTarget);
}
}
}