Add infrastructure to run codegen test on jdk 6

Perform actual codegen test execution in separate process.
One server process is used to run all codegen tests
through socket connection.
This commit is contained in:
Mikhael Bogdanov
2017-04-20 16:05:16 +02:00
parent 1ee337d976
commit 9d021ee1ac
11 changed files with 434 additions and 79 deletions
+13 -4
View File
@@ -18,8 +18,17 @@ inline fun <reified T> typeLiteral(): TypeLiteral<T> = object : TypeLiteral<T>()
fun box(): String {
assertEquals("java.lang.String", (typeLiteral<String>().type as Class<*>).canonicalName)
assertEquals("java.util.List<?>", typeLiteral<List<*>>().type.toString())
assertEquals("java.lang.String[]", (typeLiteral<Array<String>>().type as Class<*>).canonicalName)
assertEquals("java.lang.Integer[]", (typeLiteral<Array<Int>>().type as Class<*>).canonicalName)
assertEquals("java.lang.String[][]", (typeLiteral<Array<Array<String>>>().type as Class<*>).canonicalName)
//note that 'type' implementation for next cases is different on jdk 6 and 8: GenericArrayType and Class
assertEquals("java.lang.String[]", typeLiteral<Array<String>>().type.canonicalName)
assertEquals("java.lang.Integer[]", typeLiteral<Array<Int>>().type.canonicalName)
assertEquals("java.lang.String[][]", typeLiteral<Array<Array<String>>>().type.canonicalName)
return "OK"
}
}
val Type.canonicalName: String
get() = when (this) {
is Class<*> -> this.canonicalName
is java.lang.reflect.GenericArrayType -> this.getGenericComponentType().canonicalName + "[]"
else -> null!!
}