Cleanup deprecated symbol usages in testData
This commit is contained in:
+1
-1
@@ -36,7 +36,7 @@ class Test<T>(val constructorProperty: T) {
|
||||
}
|
||||
|
||||
fun box(): String {
|
||||
val clz = javaClass<Test<*>>()
|
||||
val clz = Test::class.java
|
||||
|
||||
val constructorProperty = clz.getDeclaredField("constructorProperty");
|
||||
|
||||
|
||||
@@ -22,14 +22,14 @@ class Test<T, X, in Y>() {
|
||||
}
|
||||
|
||||
fun box(): String {
|
||||
val clz = javaClass<Test<*, *, *>>()
|
||||
val clz = Test::class.java
|
||||
|
||||
val params = listOf(
|
||||
Params(1, javaClass<Any>(), "T", "T"),
|
||||
Params(2, javaClass<Z<*>>(), "Z<T>", "Z<T>"),
|
||||
Params(3, javaClass<Z<*>>(), "Z<java.lang.String>", "Z<java.lang.String>"),
|
||||
Params(4, javaClass<Any>(), "Zout<java.lang.String>", "X"),
|
||||
Params(5, javaClass<Any>(), "Zin<TParam>", "Y")
|
||||
Params(1, Any::class.java, "T", "T"),
|
||||
Params(2, Z::class.java, "Z<T>", "Z<T>"),
|
||||
Params(3, Z::class.java, "Z<java.lang.String>", "Z<java.lang.String>"),
|
||||
Params(4, Any::class.java, "Zout<java.lang.String>", "X"),
|
||||
Params(5, Any::class.java, "Zin<TParam>", "Y")
|
||||
)
|
||||
|
||||
|
||||
|
||||
@@ -15,7 +15,7 @@ class C {
|
||||
}
|
||||
|
||||
fun box(): String {
|
||||
val c = javaClass<C>()
|
||||
val c = C::class.java
|
||||
|
||||
if (c.getDeclaredField("vol").getModifiers() and Modifier.VOLATILE == 0) return "Fail: volatile"
|
||||
if (c.getDeclaredField("tra").getModifiers() and Modifier.TRANSIENT == 0) return "Fail: transient"
|
||||
|
||||
@@ -18,7 +18,7 @@ fun box(): String {
|
||||
return "Link error expected on object"
|
||||
}
|
||||
catch (e: java.lang.UnsatisfiedLinkError) {
|
||||
if (e.getMessage() != "foo.ObjWithNative.bar(JLjava/lang/String;)D") return "Fail 1: " + e.getMessage()
|
||||
if (e.message != "foo.ObjWithNative.bar(JLjava/lang/String;)D") return "Fail 1: " + e.message
|
||||
}
|
||||
|
||||
try {
|
||||
@@ -26,7 +26,7 @@ fun box(): String {
|
||||
return "Link error expected on object"
|
||||
}
|
||||
catch (e: java.lang.UnsatisfiedLinkError) {
|
||||
if (e.getMessage() != "foo.ObjWithNative.foo(I)D") return "Fail 2: " + e.getMessage()
|
||||
if (e.message != "foo.ObjWithNative.foo(I)D") return "Fail 2: " + e.message
|
||||
}
|
||||
|
||||
try {
|
||||
@@ -34,7 +34,7 @@ fun box(): String {
|
||||
return "Link error expected on object"
|
||||
}
|
||||
catch (e: java.lang.UnsatisfiedLinkError) {
|
||||
if (e.getMessage() != "foo.DefaultKt.topLevel(I)D") return "Fail 3: " + e.getMessage()
|
||||
if (e.message != "foo.DefaultKt.topLevel(I)D") return "Fail 3: " + e.message
|
||||
}
|
||||
return "OK"
|
||||
}
|
||||
+1
-1
@@ -29,7 +29,7 @@ fun check(body: () -> Unit, signature: String): String? {
|
||||
return "Link error expected"
|
||||
}
|
||||
catch (e: java.lang.UnsatisfiedLinkError) {
|
||||
if (e.getMessage() != signature) return "Fail $signature: " + e.getMessage()
|
||||
if (e.message != signature) return "Fail $signature: " + e.message
|
||||
}
|
||||
|
||||
return null
|
||||
|
||||
@@ -16,7 +16,7 @@ fun box(): String {
|
||||
return "Link error expected"
|
||||
}
|
||||
catch (e: java.lang.UnsatisfiedLinkError) {
|
||||
if (e.getMessage() != "C.foo()V") return "Fail 1: " + e.getMessage()
|
||||
if (e.message != "C.foo()V") return "Fail 1: " + e.message
|
||||
}
|
||||
|
||||
return "OK"
|
||||
|
||||
@@ -19,7 +19,7 @@ fun box(): String {
|
||||
return "Link error expected"
|
||||
}
|
||||
catch (e: java.lang.UnsatisfiedLinkError) {
|
||||
if (e.getMessage() != "foo.WithNative.bar(JLjava/lang/String;)D") return "Fail 1: " + e.getMessage()
|
||||
if (e.message != "foo.WithNative.bar(JLjava/lang/String;)D") return "Fail 1: " + e.message
|
||||
}
|
||||
|
||||
try {
|
||||
@@ -27,7 +27,7 @@ fun box(): String {
|
||||
return "Link error expected on object"
|
||||
}
|
||||
catch (e: java.lang.UnsatisfiedLinkError) {
|
||||
if (e.getMessage() != "foo.ObjWithNative.bar(JLjava/lang/String;)D") return "Fail 2: " + e.getMessage()
|
||||
if (e.message != "foo.ObjWithNative.bar(JLjava/lang/String;)D") return "Fail 2: " + e.message
|
||||
}
|
||||
return "OK"
|
||||
}
|
||||
@@ -12,7 +12,7 @@ fun box(): String {
|
||||
return "Link error expected on object"
|
||||
}
|
||||
catch (e: java.lang.UnsatisfiedLinkError) {
|
||||
if (e.getMessage() != "foo.TopLevelKt.bar(JLjava/lang/String;)D") return "Fail 1: " + e.getMessage()
|
||||
if (e.message != "foo.TopLevelKt.bar(JLjava/lang/String;)D") return "Fail 1: " + e.message
|
||||
}
|
||||
|
||||
return "OK"
|
||||
|
||||
+1
-1
@@ -8,7 +8,7 @@ fun box(): String {
|
||||
return "Fail: an exception should be thrown"
|
||||
} catch (e: IllegalStateException) {
|
||||
val st = (e as java.lang.Throwable).getStackTrace()
|
||||
if (st.size() < 5) {
|
||||
if (st.size < 5) {
|
||||
return "Fail: very small stack trace, should at least have current function and JUnit reflective calls: ${Arrays.toString(st)}"
|
||||
}
|
||||
val top = st[0]
|
||||
|
||||
@@ -6,9 +6,9 @@ import kotlin.test.assertTrue
|
||||
import java.security.KeyPair
|
||||
|
||||
|
||||
fun <T> testCollectionSize(c: Collection<T>) = assertEquals(0, c.size())
|
||||
fun <T> testCollectionSize(c: Collection<T>) = assertEquals(0, c.size)
|
||||
fun <T> testCollectionIsEmpty(c: Collection<T>) = assertTrue(c.isEmpty())
|
||||
fun <T> testCollectionContains(c: Collection<T>) = assertTrue(c.contains(1))
|
||||
fun <T> testCollectionContains(c: Collection<T>) = assertTrue(c.contains(1 as Any?))
|
||||
fun <T> testCollectionIterator(c: Collection<T>) {
|
||||
val it = c.iterator()
|
||||
while (it.hasNext()) {
|
||||
@@ -18,12 +18,12 @@ fun <T> testCollectionIterator(c: Collection<T>) {
|
||||
fun <T> testCollectionContainsAll(c: Collection<T>) = assertTrue(c.containsAll(c))
|
||||
fun <T> testMutableCollectionAdd(c: MutableCollection<T>, t: T) {
|
||||
c.add(t)
|
||||
assertEquals(1, c.size())
|
||||
assertEquals(1, c.size)
|
||||
assertTrue(c.contains(t))
|
||||
}
|
||||
fun <T> testMutableCollectionRemove(c: MutableCollection<T>, t: T) {
|
||||
c.remove(t)
|
||||
assertEquals(0, c.size())
|
||||
assertEquals(0, c.size)
|
||||
assertFalse(c.contains(t))
|
||||
}
|
||||
fun <T> testMutableCollectionIterator(c: MutableCollection<T>, t: T) {
|
||||
@@ -33,7 +33,7 @@ fun <T> testMutableCollectionIterator(c: MutableCollection<T>, t: T) {
|
||||
it.next()
|
||||
it.remove()
|
||||
}
|
||||
assertEquals(0, c.size())
|
||||
assertEquals(0, c.size)
|
||||
}
|
||||
fun <T> testMutableCollectionAddAll(c: MutableCollection<T>, t1: T, t2: T) {
|
||||
c.addAll(arrayListOf(t1, t2))
|
||||
@@ -114,16 +114,16 @@ fun testList() {
|
||||
}
|
||||
|
||||
fun <K, V> testMapContainsKey(map: Map<K, V>, k: K) = assertTrue(map.containsKey(k))
|
||||
fun <K, V> testMapKeys(map: Map<K, V>, k1: K, k2: K) = assertEqualCollections(hashSetOf(k1, k2), map.keySet())
|
||||
fun <K, V> testMapValues(map: Map<K, V>, v1: V, v2: V) = assertEqualCollections(hashSetOf(v1, v2), map.values())
|
||||
fun <K, V> testMapKeys(map: Map<K, V>, k1: K, k2: K) = assertEqualCollections(hashSetOf(k1, k2), map.keys)
|
||||
fun <K, V> testMapValues(map: Map<K, V>, v1: V, v2: V) = assertEqualCollections(hashSetOf(v1, v2), map.values)
|
||||
fun <K, V> testMapEntrySet(map: Map<K, V>, k : K, v: V) {
|
||||
for (entry in map.entrySet()) {
|
||||
for (entry in map.entries) {
|
||||
assertEquals(k, entry.key)
|
||||
assertEquals(v, entry.value)
|
||||
}
|
||||
}
|
||||
fun <K, V> testMutableMapEntry(map: MutableMap<K, V>, k1 : K, v: V) {
|
||||
for (entry in map.entrySet()) {
|
||||
for (entry in map.entries) {
|
||||
entry.setValue(v)
|
||||
}
|
||||
assertEquals(hashMapOf(k1 to v), map)
|
||||
|
||||
@@ -34,24 +34,24 @@ class Luhny() {
|
||||
// }
|
||||
|
||||
if (it.isDigit()) {
|
||||
digits.addLast(it.toInt() - '0'.toInt())
|
||||
digits.addLast(it - '0')
|
||||
} else if (it == ' ' || it == '-') {
|
||||
} else {
|
||||
printAll()
|
||||
digits.clear()
|
||||
}
|
||||
|
||||
if (digits.size() > 16)
|
||||
if (digits.size > 16)
|
||||
printOneDigit()
|
||||
check()
|
||||
}
|
||||
|
||||
fun check() {
|
||||
if (digits.size() < 14) return
|
||||
if (digits.size < 14) return
|
||||
print("check")
|
||||
val sum = digits.sum { i, d ->
|
||||
// println("$i -> $d")
|
||||
if (i % 2 == digits.size()) {
|
||||
if (i % 2 == digits.size) {
|
||||
val f = d * 2 / 10
|
||||
val s = d * 2 % 10
|
||||
// println("$d: f = $f, s = $s")
|
||||
@@ -61,7 +61,7 @@ class Luhny() {
|
||||
} else d
|
||||
}
|
||||
// println(sum)
|
||||
if (sum % 10 == 0) {print("s"); toBeMasked = digits.size()}
|
||||
if (sum % 10 == 0) {print("s"); toBeMasked = digits.size}
|
||||
}
|
||||
|
||||
fun printOneDigit() {
|
||||
@@ -98,8 +98,8 @@ fun <T> T.pr(f : (T) -> Unit) : T {
|
||||
|
||||
fun LinkedList<Int>.sum(f : (Int, Int )-> Int): Int {
|
||||
var sum = 0
|
||||
for (i in 1..size()) {
|
||||
val j = size() - i
|
||||
for (i in 1..size) {
|
||||
val j = size - i
|
||||
sum += f(j, get(j))
|
||||
}
|
||||
return sum
|
||||
|
||||
@@ -31,19 +31,19 @@ class Luhny() {
|
||||
// }
|
||||
|
||||
if (it.isDigit()) {
|
||||
digits.addLast(it.toInt() - '0'.toInt())
|
||||
digits.addLast(it - '0')
|
||||
} else if (it == ' ' || it == '-') {
|
||||
} else {
|
||||
printAll()
|
||||
}
|
||||
|
||||
if (digits.size() > 16)
|
||||
if (digits.size > 16)
|
||||
printOneDigit()
|
||||
check()
|
||||
}
|
||||
|
||||
private fun check() {
|
||||
val size = digits.size()
|
||||
val size = digits.size
|
||||
if (size < 14) return
|
||||
val sum = digits.sum {i, d ->
|
||||
if (i % 2 == size % 2) double(d) else d
|
||||
@@ -54,7 +54,7 @@ class Luhny() {
|
||||
// sum += if (i % 2 == size % 2) double(d) else d
|
||||
// i++
|
||||
// }
|
||||
if (sum % 10 == 0) toBeMasked = digits.size()
|
||||
if (sum % 10 == 0) toBeMasked = digits.size
|
||||
}
|
||||
|
||||
private fun double(d : Int) = d * 2 / 10 + d * 2 % 10
|
||||
|
||||
@@ -35,26 +35,26 @@ class Luhny() {
|
||||
// }
|
||||
|
||||
if (it.isDigit()) {
|
||||
digits.push(it.toInt() - '0'.toInt())
|
||||
digits.push(it - '0')
|
||||
} else if (it == ' ' || it == '-') {
|
||||
} else {
|
||||
printAll()
|
||||
digits.clear()
|
||||
}
|
||||
|
||||
if (digits.size() > 16)
|
||||
if (digits.size > 16)
|
||||
printOneDigit()
|
||||
check()
|
||||
}
|
||||
|
||||
fun check() {
|
||||
if (digits.size() < 14) return
|
||||
if (digits.size < 14) return
|
||||
val sum = digits.sum { i, d ->
|
||||
if (i % 2 != 0)
|
||||
d * 2 / 10 + d * 2 % 10
|
||||
else d
|
||||
}
|
||||
if (sum % 10 == 0) toBeMasked = digits.size()
|
||||
if (sum % 10 == 0) toBeMasked = digits.size
|
||||
}
|
||||
|
||||
fun printOneDigit() {
|
||||
@@ -97,7 +97,7 @@ fun LinkedList<Int>.sum(f : (Int, Int) -> Int) : Int {
|
||||
fun <T> List<T>.backwards() : Iterable<T> = object : Iterable<T> {
|
||||
override fun iterator() : Iterator<T> =
|
||||
object : Iterator<T> {
|
||||
var current = size()
|
||||
var current = size
|
||||
override fun next() : T = get(--current)
|
||||
override fun hasNext() : Boolean = current > 0
|
||||
}
|
||||
|
||||
+11
-11
@@ -56,7 +56,7 @@ class TestLocal(val name: String, val executionType: ExecutionType) : Callable<S
|
||||
fun nonLocalSimple(): String {
|
||||
synchronized(mutex) {
|
||||
underMutexFun()
|
||||
return executionType.name()
|
||||
return executionType.name
|
||||
}
|
||||
return "fail"
|
||||
}
|
||||
@@ -65,9 +65,9 @@ class TestLocal(val name: String, val executionType: ExecutionType) : Callable<S
|
||||
synchronized(mutex) {
|
||||
try {
|
||||
underMutexFun()
|
||||
throw MyException(executionType.name())
|
||||
throw MyException(executionType.name)
|
||||
} catch (e: MyException) {
|
||||
return e.getMessage()!!
|
||||
return e.message!!
|
||||
}
|
||||
}
|
||||
return "fail"
|
||||
@@ -79,7 +79,7 @@ class TestLocal(val name: String, val executionType: ExecutionType) : Callable<S
|
||||
underMutexFun()
|
||||
return "fail"
|
||||
} finally {
|
||||
return executionType.name()
|
||||
return executionType.name
|
||||
}
|
||||
}
|
||||
return "fail"
|
||||
@@ -89,9 +89,9 @@ class TestLocal(val name: String, val executionType: ExecutionType) : Callable<S
|
||||
synchronized(mutex) {
|
||||
try {
|
||||
underMutexFun()
|
||||
throw MyException(executionType.name())
|
||||
throw MyException(executionType.name)
|
||||
} catch (e: MyException) {
|
||||
return e.getMessage()!!
|
||||
return e.message!!
|
||||
} finally {
|
||||
"123"
|
||||
}
|
||||
@@ -103,11 +103,11 @@ class TestLocal(val name: String, val executionType: ExecutionType) : Callable<S
|
||||
synchronized(mutex) {
|
||||
try {
|
||||
underMutexFun()
|
||||
throw MyException(executionType.name())
|
||||
throw MyException(executionType.name)
|
||||
} catch (e: MyException) {
|
||||
return "fail1"
|
||||
} finally {
|
||||
return executionType.name()
|
||||
return executionType.name
|
||||
}
|
||||
}
|
||||
return "fail"
|
||||
@@ -118,11 +118,11 @@ class TestLocal(val name: String, val executionType: ExecutionType) : Callable<S
|
||||
try {
|
||||
try {
|
||||
underMutexFun()
|
||||
throw MyException(executionType.name())
|
||||
throw MyException(executionType.name)
|
||||
} catch (e: MyException) {
|
||||
return "fail1"
|
||||
} finally {
|
||||
return executionType.name()
|
||||
return executionType.name
|
||||
}
|
||||
} finally {
|
||||
val p = 1 + 1
|
||||
@@ -150,7 +150,7 @@ fun testTemplate(type: ExecutionType, producer: (Int) -> Callable<String>): Stri
|
||||
}
|
||||
|
||||
for (f in futures) {
|
||||
if (f.get() != type.name()) return "failed result ${f.get()} != ${type.name()}"
|
||||
if (f.get() != type.name) return "failed result ${f.get()} != ${type.name}"
|
||||
}
|
||||
} finally {
|
||||
|
||||
|
||||
Reference in New Issue
Block a user