Use mock JDK in compiler tests where full JDK is not needed
- move some of boxWithStdlib tests under fullJdk/ directory, where they will be compiled against the full JDK - introduce FULL_JDK in-text directive for the reflection test as only 4 tests out of 654 needed the full JDK
This commit is contained in:
@@ -1,19 +0,0 @@
|
||||
import kotlin.test.assertEquals
|
||||
import java.lang.reflect.ParameterizedType
|
||||
import java.lang.reflect.Type
|
||||
|
||||
open class TypeLiteral<T> {
|
||||
val type: Type
|
||||
get() = (javaClass.getGenericSuperclass() as ParameterizedType).getActualTypeArguments()[0]
|
||||
}
|
||||
|
||||
inline fun <reified T> typeLiteral(): TypeLiteral<T> = object : TypeLiteral<T>() {}
|
||||
|
||||
fun box(): String {
|
||||
assertEquals("class java.lang.String", typeLiteral<String>().type.toString())
|
||||
assertEquals("java.util.List<?>", typeLiteral<List<*>>().type.toString())
|
||||
assertEquals("java.lang.String[]", typeLiteral<Array<String>>().type.toString())
|
||||
assertEquals("java.lang.Integer[]", typeLiteral<Array<Int>>().type.toString())
|
||||
assertEquals("java.lang.String[][]", typeLiteral<Array<Array<String>>>().type.toString())
|
||||
return "OK"
|
||||
}
|
||||
Reference in New Issue
Block a user