Skip to content

Commit 3f0bc85

Browse files
committed
优化
1 parent 40cb1de commit 3f0bc85

File tree

2 files changed

+4
-3
lines changed

2 files changed

+4
-3
lines changed

test/com/github/masx200/leetcode_test/operations_lcci/OperationsTest.kt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ class OperationsTest {
3535
]
3636
"""
3737
)
38-
val expected: List<Any?> = runScript(
38+
@Suppress("UNCHECKED_CAST") val expected: List<Any?> = runScript(
3939
Json.decodeFromString(
4040
"""
4141
[
@@ -80,7 +80,7 @@ class OperationsTest {
8080

8181
expected.map { if (it is Number) it.toLong() else it },
8282
actual.map { if (it is Number) it.toLong() else it }
83-
);
83+
)
8484
}
8585

8686

utils/runScript.kt

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ fun runScript(commands: List<String>, inputs: ArrayList<ArrayList<Any>>, classes
2828
// println(arg[0].javaClass)
2929

3030
for (j in arg.indices) {
31+
@Suppress("KotlinConstantConditions")
3132
if (arg[j].javaClass != (fu.parameters[j + 1].type.classifier) as KClass<*>) {
3233
val jvmName = (fu.parameters[j + 1].type.classifier as KClass<*>).jvmName
3334
val old = arg[j]
@@ -41,7 +42,7 @@ fun runScript(commands: List<String>, inputs: ArrayList<ArrayList<Any>>, classes
4142
"short" -> old.toShort()
4243
"byte" -> old.toByte()
4344
else -> {
44-
throw Error("error number type:" + jvmName)
45+
throw Error("error number type:$jvmName")
4546
}
4647
}
4748
}

0 commit comments

Comments
 (0)