Use 'JVM_TARGET: 1.8' directive in codegen tests on 1.8 target
This commit is contained in:
@@ -1,4 +1,5 @@
|
|||||||
// KOTLIN_CONFIGURATION_FLAGS: +JVM.JVM_8_TARGET
|
// JVM_TARGET: 1.8
|
||||||
|
|
||||||
interface Test<T> {
|
interface Test<T> {
|
||||||
fun test(p: T): T {
|
fun test(p: T): T {
|
||||||
return p
|
return p
|
||||||
@@ -18,4 +19,3 @@ fun <T> execute(t: Test<T>, p: T): T {
|
|||||||
fun box(): String {
|
fun box(): String {
|
||||||
return execute(TestClass(), "O")
|
return execute(TestClass(), "O")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
// KOTLIN_CONFIGURATION_FLAGS: +JVM.JVM_8_TARGET
|
// JVM_TARGET: 1.8
|
||||||
|
|
||||||
interface Test<T> {
|
interface Test<T> {
|
||||||
fun test(p: T): T {
|
fun test(p: T): T {
|
||||||
return p
|
return p
|
||||||
@@ -21,4 +22,3 @@ fun <T> execute(t: Test<T>, p: T): T {
|
|||||||
fun box(): String {
|
fun box(): String {
|
||||||
return execute(TestClass(), "O")
|
return execute(TestClass(), "O")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+5
-3
@@ -1,6 +1,7 @@
|
|||||||
// KOTLIN_CONFIGURATION_FLAGS: +JVM.JVM_8_TARGET
|
// JVM_TARGET: 1.8
|
||||||
// WITH_REFLECT
|
// WITH_REFLECT
|
||||||
// FULL_JDK
|
// FULL_JDK
|
||||||
|
|
||||||
interface Test {
|
interface Test {
|
||||||
fun test(): String {
|
fun test(): String {
|
||||||
return "Test"
|
return "Test"
|
||||||
@@ -30,6 +31,7 @@ class TestClass2 : TestClass(), Test3 {
|
|||||||
fun box(): String {
|
fun box(): String {
|
||||||
val test = TestClass2().test()
|
val test = TestClass2().test()
|
||||||
if (test != "Test2") return "fail 1: $test"
|
if (test != "Test2") return "fail 1: $test"
|
||||||
|
// TODO: enable this test once the required behavior is specified
|
||||||
// checkNoMethod(TestClass::class.java, "test")
|
// checkNoMethod(TestClass::class.java, "test")
|
||||||
// checkNoMethod(Test3::class.java, "test")
|
// checkNoMethod(Test3::class.java, "test")
|
||||||
// checkNoMethod(TestClass2::class.java, "test")
|
// checkNoMethod(TestClass2::class.java, "test")
|
||||||
@@ -44,5 +46,5 @@ fun checkNoMethod(clazz: Class<*>, name: String) {
|
|||||||
catch (e: NoSuchMethodException) {
|
catch (e: NoSuchMethodException) {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
throw java.lang.AssertionError("fail " + clazz)
|
throw AssertionError("fail " + clazz)
|
||||||
}
|
}
|
||||||
|
|||||||
Vendored
+3
-2
@@ -1,4 +1,4 @@
|
|||||||
// KOTLIN_CONFIGURATION_FLAGS: +JVM.JVM_8_TARGET
|
// JVM_TARGET: 1.8
|
||||||
// WITH_RUNTIME
|
// WITH_RUNTIME
|
||||||
// FULL_JDK
|
// FULL_JDK
|
||||||
interface Test {
|
interface Test {
|
||||||
@@ -11,6 +11,7 @@ class TestClass : Test {
|
|||||||
}
|
}
|
||||||
|
|
||||||
fun box(): String {
|
fun box(): String {
|
||||||
|
// TODO: enable this test once the required behavior is specified
|
||||||
// try {
|
// try {
|
||||||
// TestClass::class.java.getDeclaredMethod("test")
|
// TestClass::class.java.getDeclaredMethod("test")
|
||||||
// }
|
// }
|
||||||
@@ -19,4 +20,4 @@ fun box(): String {
|
|||||||
// }
|
// }
|
||||||
// return "fail"
|
// return "fail"
|
||||||
return "OK"
|
return "OK"
|
||||||
}
|
}
|
||||||
|
|||||||
Vendored
+3
-2
@@ -1,4 +1,4 @@
|
|||||||
// KOTLIN_CONFIGURATION_FLAGS: +JVM.JVM_8_TARGET
|
// JVM_TARGET: 1.8
|
||||||
// WITH_RUNTIME
|
// WITH_RUNTIME
|
||||||
// FULL_JDK
|
// FULL_JDK
|
||||||
interface Test {
|
interface Test {
|
||||||
@@ -11,6 +11,7 @@ interface Test2 : Test {
|
|||||||
}
|
}
|
||||||
|
|
||||||
fun box(): String {
|
fun box(): String {
|
||||||
|
// TODO: enable this test once the required behavior is specified
|
||||||
// try {
|
// try {
|
||||||
// Test2::class.java.getDeclaredMethod("test")
|
// Test2::class.java.getDeclaredMethod("test")
|
||||||
// }
|
// }
|
||||||
@@ -19,4 +20,4 @@ fun box(): String {
|
|||||||
// }
|
// }
|
||||||
// return "fail"
|
// return "fail"
|
||||||
return "OK"
|
return "OK"
|
||||||
}
|
}
|
||||||
|
|||||||
Vendored
+4
-2
@@ -1,6 +1,7 @@
|
|||||||
// KOTLIN_CONFIGURATION_FLAGS: +JVM.JVM_8_TARGET
|
// JVM_TARGET: 1.8
|
||||||
// WITH_RUNTIME
|
// WITH_RUNTIME
|
||||||
// FULL_JDK
|
// FULL_JDK
|
||||||
|
|
||||||
interface Test {
|
interface Test {
|
||||||
fun test() {
|
fun test() {
|
||||||
}
|
}
|
||||||
@@ -15,6 +16,7 @@ interface Test3 : Test2 {
|
|||||||
}
|
}
|
||||||
|
|
||||||
fun box(): String {
|
fun box(): String {
|
||||||
|
// TODO: enable this test once the required behavior is specified
|
||||||
// try {
|
// try {
|
||||||
// Test3::class.java.getDeclaredMethod("test")
|
// Test3::class.java.getDeclaredMethod("test")
|
||||||
// }
|
// }
|
||||||
@@ -23,4 +25,4 @@ fun box(): String {
|
|||||||
// }
|
// }
|
||||||
// return "fail"
|
// return "fail"
|
||||||
return "OK"
|
return "OK"
|
||||||
}
|
}
|
||||||
|
|||||||
+3
-2
@@ -1,4 +1,5 @@
|
|||||||
// KOTLIN_CONFIGURATION_FLAGS: +JVM.JVM_8_TARGET
|
// JVM_TARGET: 1.8
|
||||||
|
|
||||||
interface Test {
|
interface Test {
|
||||||
fun test(): String {
|
fun test(): String {
|
||||||
return "OK"
|
return "OK"
|
||||||
@@ -11,4 +12,4 @@ class TestClass : Test {
|
|||||||
|
|
||||||
fun box(): String {
|
fun box(): String {
|
||||||
return TestClass().test()
|
return TestClass().test()
|
||||||
}
|
}
|
||||||
|
|||||||
+2
-2
@@ -8,7 +8,7 @@ interface Test {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// FILE: 2.kt
|
// FILE: 2.kt
|
||||||
// KOTLIN_CONFIGURATION_FLAGS: +JVM.JVM_8_TARGET
|
// JVM_TARGET: 1.8
|
||||||
class TestClass : Test {
|
class TestClass : Test {
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -21,4 +21,4 @@ fun box(): String {
|
|||||||
return "fail"
|
return "fail"
|
||||||
}
|
}
|
||||||
return "OK"
|
return "OK"
|
||||||
}
|
}
|
||||||
|
|||||||
+2
-2
@@ -8,7 +8,7 @@ interface Test {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// FILE: 2.kt
|
// FILE: 2.kt
|
||||||
// KOTLIN_CONFIGURATION_FLAGS: +JVM.JVM_8_TARGET
|
// JVM_TARGET: 1.8
|
||||||
interface Test2 : Test {
|
interface Test2 : Test {
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -21,4 +21,4 @@ fun box(): String {
|
|||||||
return "fail"
|
return "fail"
|
||||||
}
|
}
|
||||||
return "OK"
|
return "OK"
|
||||||
}
|
}
|
||||||
|
|||||||
+3
-2
@@ -9,7 +9,7 @@ interface Test {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// FILE: 2.kt
|
// FILE: 2.kt
|
||||||
// KOTLIN_CONFIGURATION_FLAGS: +JVM.JVM_8_TARGET
|
// JVM_TARGET: 1.8
|
||||||
interface Test2 : Test {
|
interface Test2 : Test {
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -21,6 +21,7 @@ class TestClass : Test3
|
|||||||
|
|
||||||
fun box(): String {
|
fun box(): String {
|
||||||
checkPresent(Test2::class.java, "test")
|
checkPresent(Test2::class.java, "test")
|
||||||
|
// TODO: enable this test once the required behavior is specified
|
||||||
// checkNoMethod(Test3::class.java, "test")
|
// checkNoMethod(Test3::class.java, "test")
|
||||||
|
|
||||||
return TestClass().test()
|
return TestClass().test()
|
||||||
@@ -44,4 +45,4 @@ fun checkPresent(clazz: Class<*>, name: String) {
|
|||||||
throw java.lang.AssertionError("Method $name doesn't exist in $clazz")
|
throw java.lang.AssertionError("Method $name doesn't exist in $clazz")
|
||||||
}
|
}
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|||||||
Vendored
+3
-2
@@ -9,7 +9,7 @@ interface Test {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// FILE: 2.kt
|
// FILE: 2.kt
|
||||||
// KOTLIN_CONFIGURATION_FLAGS: +JVM.JVM_8_TARGET
|
// JVM_TARGET: 1.8
|
||||||
interface Test2 : Test {
|
interface Test2 : Test {
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -31,6 +31,7 @@ class TestClass : Test4 {
|
|||||||
fun box(): String {
|
fun box(): String {
|
||||||
checkPresent(Test2::class.java, "test")
|
checkPresent(Test2::class.java, "test")
|
||||||
checkPresent(Test3::class.java, "test")
|
checkPresent(Test3::class.java, "test")
|
||||||
|
// TODO: enable this test once the required behavior is specified
|
||||||
//checkNoMethod(Test4::class.java, "test")
|
//checkNoMethod(Test4::class.java, "test")
|
||||||
|
|
||||||
return TestClass().test()
|
return TestClass().test()
|
||||||
@@ -53,4 +54,4 @@ fun checkPresent(clazz: Class<*>, name: String) {
|
|||||||
throw java.lang.AssertionError("Method $name doesn't exist in $clazz")
|
throw java.lang.AssertionError("Method $name doesn't exist in $clazz")
|
||||||
}
|
}
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|||||||
Vendored
+2
-2
@@ -9,7 +9,7 @@ interface Test {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// FILE: 2.kt
|
// FILE: 2.kt
|
||||||
// KOTLIN_CONFIGURATION_FLAGS: +JVM.JVM_8_TARGET
|
// JVM_TARGET: 1.8
|
||||||
open class TestClass : Test {
|
open class TestClass : Test {
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -47,4 +47,4 @@ fun checkPresent(clazz: Class<*>, name: String) {
|
|||||||
throw java.lang.AssertionError("Method $name doesn't exist in $clazz")
|
throw java.lang.AssertionError("Method $name doesn't exist in $clazz")
|
||||||
}
|
}
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|||||||
Vendored
+2
-2
@@ -9,7 +9,7 @@ interface Test {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// FILE: 2.kt
|
// FILE: 2.kt
|
||||||
// KOTLIN_CONFIGURATION_FLAGS: +JVM.JVM_8_TARGET
|
// JVM_TARGET: 1.8
|
||||||
open class TestClass : Test {
|
open class TestClass : Test {
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -49,4 +49,4 @@ fun checkPresent(clazz: Class<*>, name: String) {
|
|||||||
throw java.lang.AssertionError("Method $name doesn't exist in $clazz")
|
throw java.lang.AssertionError("Method $name doesn't exist in $clazz")
|
||||||
}
|
}
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|||||||
+2
-2
@@ -7,11 +7,11 @@ interface Test {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// FILE: 2.kt
|
// FILE: 2.kt
|
||||||
// KOTLIN_CONFIGURATION_FLAGS: +JVM.JVM_8_TARGET
|
// JVM_TARGET: 1.8
|
||||||
class TestClass : Test {
|
class TestClass : Test {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
fun box(): String {
|
fun box(): String {
|
||||||
return TestClass().test()
|
return TestClass().test()
|
||||||
}
|
}
|
||||||
|
|||||||
Vendored
+2
-2
@@ -7,7 +7,7 @@ interface Test {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// FILE: 2.kt
|
// FILE: 2.kt
|
||||||
// KOTLIN_CONFIGURATION_FLAGS: +JVM.JVM_8_TARGET
|
// JVM_TARGET: 1.8
|
||||||
interface Test2 : Test {
|
interface Test2 : Test {
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -19,4 +19,4 @@ class TestClass : Test2 {
|
|||||||
|
|
||||||
fun box(): String {
|
fun box(): String {
|
||||||
return TestClass().test()
|
return TestClass().test()
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
// KOTLIN_CONFIGURATION_FLAGS: +JVM.JVM_8_TARGET
|
// JVM_TARGET: 1.8
|
||||||
|
|
||||||
interface Test {
|
interface Test {
|
||||||
fun test(): String {
|
fun test(): String {
|
||||||
return "OK"
|
return "OK"
|
||||||
@@ -13,4 +14,4 @@ interface Test {
|
|||||||
|
|
||||||
// TESTED_OBJECT_KIND: function
|
// TESTED_OBJECT_KIND: function
|
||||||
// TESTED_OBJECTS: Test, testAbstract
|
// TESTED_OBJECTS: Test, testAbstract
|
||||||
// FLAGS: ACC_PUBLIC, ACC_ABSTRACT
|
// FLAGS: ACC_PUBLIC, ACC_ABSTRACT
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
// KOTLIN_CONFIGURATION_FLAGS: +JVM.JVM_8_TARGET
|
// JVM_TARGET: 1.8
|
||||||
|
|
||||||
interface Test {
|
interface Test {
|
||||||
fun a() {
|
fun a() {
|
||||||
|
|
||||||
@@ -9,7 +10,6 @@ interface Test {
|
|||||||
// TESTED_OBJECTS: Test$DefaultImpls
|
// TESTED_OBJECTS: Test$DefaultImpls
|
||||||
// FLAGS: ACC_PUBLIC, ACC_FINAL, ACC_SUPER
|
// FLAGS: ACC_PUBLIC, ACC_FINAL, ACC_SUPER
|
||||||
|
|
||||||
|
|
||||||
// TESTED_OBJECT_KIND: class
|
// TESTED_OBJECT_KIND: class
|
||||||
// TESTED_OBJECTS: Test
|
// TESTED_OBJECTS: Test
|
||||||
// FLAGS: ACC_PUBLIC, ACC_ABSTRACT, ACC_INTERFACE
|
// FLAGS: ACC_PUBLIC, ACC_ABSTRACT, ACC_INTERFACE
|
||||||
|
|||||||
@@ -23,6 +23,7 @@ import com.intellij.openapi.util.Ref;
|
|||||||
import com.intellij.openapi.util.io.FileUtil;
|
import com.intellij.openapi.util.io.FileUtil;
|
||||||
import com.intellij.testFramework.TestDataFile;
|
import com.intellij.testFramework.TestDataFile;
|
||||||
import kotlin.collections.ArraysKt;
|
import kotlin.collections.ArraysKt;
|
||||||
|
import kotlin.collections.CollectionsKt;
|
||||||
import kotlin.io.FilesKt;
|
import kotlin.io.FilesKt;
|
||||||
import kotlin.text.Charsets;
|
import kotlin.text.Charsets;
|
||||||
import org.jetbrains.annotations.NotNull;
|
import org.jetbrains.annotations.NotNull;
|
||||||
@@ -38,6 +39,7 @@ import org.jetbrains.kotlin.codegen.forTestCompile.ForTestCompileRuntime;
|
|||||||
import org.jetbrains.kotlin.config.CompilerConfiguration;
|
import org.jetbrains.kotlin.config.CompilerConfiguration;
|
||||||
import org.jetbrains.kotlin.config.CompilerConfigurationKey;
|
import org.jetbrains.kotlin.config.CompilerConfigurationKey;
|
||||||
import org.jetbrains.kotlin.config.JVMConfigurationKeys;
|
import org.jetbrains.kotlin.config.JVMConfigurationKeys;
|
||||||
|
import org.jetbrains.kotlin.config.JvmTarget;
|
||||||
import org.jetbrains.kotlin.fileClasses.JvmFileClassUtil;
|
import org.jetbrains.kotlin.fileClasses.JvmFileClassUtil;
|
||||||
import org.jetbrains.kotlin.name.FqName;
|
import org.jetbrains.kotlin.name.FqName;
|
||||||
import org.jetbrains.kotlin.psi.KtFile;
|
import org.jetbrains.kotlin.psi.KtFile;
|
||||||
@@ -146,6 +148,14 @@ public abstract class CodegenTestCase extends KtUsefulTestCase {
|
|||||||
List<String> kotlinConfigurationFlags = new ArrayList<String>(0);
|
List<String> kotlinConfigurationFlags = new ArrayList<String>(0);
|
||||||
for (TestFile testFile : testFilesWithConfigurationDirectives) {
|
for (TestFile testFile : testFilesWithConfigurationDirectives) {
|
||||||
kotlinConfigurationFlags.addAll(InTextDirectivesUtils.findListWithPrefixes(testFile.content, "// KOTLIN_CONFIGURATION_FLAGS:"));
|
kotlinConfigurationFlags.addAll(InTextDirectivesUtils.findListWithPrefixes(testFile.content, "// KOTLIN_CONFIGURATION_FLAGS:"));
|
||||||
|
|
||||||
|
List<String> lines = InTextDirectivesUtils.findLinesWithPrefixesRemoved(testFile.content, "// JVM_TARGET:");
|
||||||
|
if (!lines.isEmpty()) {
|
||||||
|
String targetString = CollectionsKt.single(lines);
|
||||||
|
JvmTarget jvmTarget = JvmTarget.Companion.fromString(targetString);
|
||||||
|
assert jvmTarget != null : "Unknown target: " + targetString;
|
||||||
|
configuration.put(JVMConfigurationKeys.JVM_TARGET, jvmTarget);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
updateConfigurationWithFlags(configuration, kotlinConfigurationFlags);
|
updateConfigurationWithFlags(configuration, kotlinConfigurationFlags);
|
||||||
|
|||||||
Reference in New Issue
Block a user