[Test] Move test on modern jdk to separate test runners

This is needed to avoid problems with installation of proper jdk
  on developer machines. Those tests will be moved back to main box
  suites after migrating our tests on LTS versions of jdk (11 and 17
  instead of 9 and 15)
This commit is contained in:
Dmitriy Novozhilov
2021-07-15 16:10:41 +03:00
committed by teamcityserver
parent 89bd52c7d2
commit 1fa74ef939
31 changed files with 394 additions and 497 deletions
@@ -0,0 +1 @@
<modernJava>
@@ -0,0 +1,30 @@
// !API_VERSION: 1.5
// !LANGUAGE: +JvmRecordSupport
// ENABLE_JVM_PREVIEW
// FILE: JavaClass.java
public class JavaClass {
public static String box() {
MyRec m = new MyRec<String>("O", "K");
return m.x() + m.y();
}
}
// FILE: main.kt
@JvmRecord
data class MyRec<R>(val x: String, val y: R)
fun box(): String {
val recordComponents = MyRec::class.java.recordComponents
val x = recordComponents[0]
val y = recordComponents[1]
if (x.name != "x") return "fail 1: ${x.name}"
if (x.type != String::class.java) return "fail 2: ${x.type}"
if (x.genericSignature != null) return "fail 3: ${x.genericSignature}"
if (y.name != "y") return "fail 4: ${y.name}"
if (y.type != Any::class.java) return "fail 5: ${y.type}"
if (y.genericSignature != "TR;") return "fail 6: ${y.genericSignature}"
return JavaClass.box()
}
@@ -0,0 +1,34 @@
// !API_VERSION: 1.5
// !LANGUAGE: +JvmRecordSupport
// ENABLE_JVM_PREVIEW
@JvmRecord
data class MyRec(override val size: Int) : Collection<String> {
override fun contains(element: String): Boolean {
TODO("Not yet implemented")
}
override fun containsAll(elements: Collection<String>): Boolean {
TODO("Not yet implemented")
}
override fun isEmpty(): Boolean {
TODO("Not yet implemented")
}
override fun iterator(): Iterator<String> {
TODO("Not yet implemented")
}
}
fun box(m: MyRec, c: Collection<*>): String {
val c: Collection<*> = m
if (m.size != 56) return "fail 1"
if (c.size != 56) return "fail 2"
return "OK"
}
fun box(): String {
val m = MyRec(56)
return box(m, m)
}
@@ -0,0 +1,17 @@
// !API_VERSION: 1.5
// !LANGUAGE: +JvmRecordSupport
// ENABLE_JVM_PREVIEW
@JvmRecord
data class MyRec<R>(val x: String, val y: R)
fun box(): String {
val m1 = MyRec("O", "K")
val m2 = MyRec("O", "K")
if (m1 != m2) return "fail 1"
if (m1.hashCode() != m2.hashCode()) return "fail 2"
if (m1.toString() != "MyRec(x=O, y=K)") return "fail 3: $m1"
return "OK"
}
@@ -0,0 +1,16 @@
// !API_VERSION: 1.5
// !LANGUAGE: +JvmRecordSupport
// ENABLE_JVM_PREVIEW
// MODULE: lib
// FILE: A.kt
@JvmRecord
data class MyRecord(val foo: String, val bar: String)
// MODULE: main(lib)
// FILE: B.kt
fun box(): String {
val myRecord = MyRecord("O", "K")
return myRecord.foo + myRecord.bar
}
@@ -0,0 +1,27 @@
// !API_VERSION: 1.5
// !LANGUAGE: +JvmRecordSupport
// ENABLE_JVM_PREVIEW
// FILE: JavaClass.java
public class JavaClass {
public static String box() {
MyRec m = new MyRec<String>("O", "K");
KI<String> ki = m;
return m.x() + m.y() + ki.getX() + ki.getY();
}
}
// FILE: main.kt
interface KI<T> {
val x: String get() = ""
val y: T
}
@JvmRecord
data class MyRec<R>(override val x: String, override val y: R) : KI<R>
fun box(): String {
val res = JavaClass.box()
if (res != "OKOK") return "fail 1: $res"
return "OK"
}
@@ -0,0 +1,28 @@
// !API_VERSION: 1.5
// !LANGUAGE: +JvmRecordSupport
// ENABLE_JVM_PREVIEW
// !JVM_DEFAULT_MODE: all-compatibility
// FILE: JavaClass.java
public class JavaClass {
public static String box() {
MyRec m = new MyRec<String>("O", "K");
KI<String> ki = m;
return m.x() + m.y() + ki.getX() + ki.getY();
}
}
// FILE: main.kt
interface KI<T> {
val x: String get() = ""
val y: T
}
@JvmRecord
data class MyRec<R>(override val x: String, override val y: R) : KI<R>
fun box(): String {
val res = JavaClass.box()
if (res != "OKOK") return "fail 1: $res"
return "OK"
}
@@ -0,0 +1,28 @@
// !API_VERSION: 1.5
// !LANGUAGE: +JvmRecordSupport
// ENABLE_JVM_PREVIEW
// !JVM_DEFAULT_MODE: enable
// FILE: JavaClass.java
public class JavaClass {
public static String box() {
MyRec m = new MyRec<String>("O", "K");
KI<String> ki = m;
return m.x() + m.y() + ki.getX() + ki.getY();
}
}
// FILE: main.kt
interface KI<T> {
val x: String get() = ""
val y: T
}
@JvmRecord
data class MyRec<R>(override val x: String, override val y: R) : KI<R>
fun box(): String {
val res = JavaClass.box()
if (res != "OKOK") return "fail 1: $res"
return "OK"
}
@@ -0,0 +1,21 @@
// ENABLE_JVM_PREVIEW
// FILE: MyRec.java
public record MyRec(String name) implements KI {
public String getName() {
return "OK";
}
}
// FILE: main.kt
interface KI {
val name: String
}
fun box(): String {
val r = MyRec("fail")
if (r.name() != "fail") return "fail 1"
if ((r as KI).name != "OK") return "fail 2"
return r.name
}
@@ -0,0 +1,16 @@
// ENABLE_JVM_PREVIEW
// FILE: MyRec.java
public record MyRec(String name) {
public String getName() {
return "OK";
}
}
// FILE: main.kt
fun box(): String {
val r = MyRec("fail")
if (r.name() != "fail") return "fail 1"
if (r.getName() != "OK") return "fail 2"
return r.name
}
@@ -0,0 +1,12 @@
// !LANGUAGE: +JvmRecordSupport
// ENABLE_JVM_PREVIEW
// FILE: MyRec.java
public record MyRec(String name) {}
// FILE: recordPropertyAccess.kt
fun box(): String {
val r = MyRec("OK")
if (r.name() != "OK") return "fail 1"
return r.name
}