Fix reflection-related codegen tests on JDK 9+
In JDK 9, Class.simpleName changed behavior for local/anonymous Kotlin classes (see KT-23072), this is why we now check for both variants of the name in tests. Also, the format of annotation arguments changed a little, where float parameters no longer have the trailing "f", and class literals are rendered with ".class" at the end
This commit is contained in:
+7
-2
@@ -12,10 +12,15 @@ fun test(s: S) {
|
||||
val localKClass = Local::class
|
||||
val localJClass = localKClass.java
|
||||
|
||||
assertEquals("test\$Local", localKClass.simpleName)
|
||||
val kName = localKClass.simpleName
|
||||
// See https://youtrack.jetbrains.com/issue/KT-29413
|
||||
// assertEquals("Local", kName)
|
||||
if (kName != "Local" && kName != "test\$Local") throw AssertionError("Fail KClass: $kName")
|
||||
|
||||
assertTrue { localJClass.isLocalClass }
|
||||
assertEquals("test\$Local", localJClass.simpleName)
|
||||
|
||||
val jName = localJClass.simpleName
|
||||
if (jName != "Local" && jName != "test\$Local") throw AssertionError("Fail java.lang.Class: $jName")
|
||||
}
|
||||
|
||||
fun box(): String {
|
||||
|
||||
Reference in New Issue
Block a user