mirror of
https://github.com/github/codeql.git
synced 2025-12-17 09:13:20 +01:00
We are no longer bound to the platform-specific directories, so simplify the test organization. If you don't want this change, just skip merging this PR. It's purely optional. I kept the platform-specific directories around under `kotlin`, but you could also easily merge all these together if you find them unhelpful. I'll leave that change to you.
46 lines
1.2 KiB
Kotlin
46 lines
1.2 KiB
Kotlin
import extlib.*
|
|
import java.util.*
|
|
|
|
fun test() {
|
|
|
|
// Pending better varargs support, avoiding listOf and mutableListOf
|
|
val stringList = ArrayList<String>()
|
|
val objectList = ArrayList<Any>()
|
|
val stringStringList = ArrayList<ArrayList<String>>()
|
|
|
|
val lib = Lib()
|
|
lib.testParameterTypes(
|
|
'a',
|
|
1,
|
|
2,
|
|
3,
|
|
4,
|
|
5.0f,
|
|
6.0,
|
|
true,
|
|
Lib(),
|
|
GenericTest<String>(),
|
|
BoundedGenericTest<String>(),
|
|
ComplexBoundedGenericTest<CharSequence, String>(),
|
|
intArrayOf(1),
|
|
arrayOf(1),
|
|
arrayOf(intArrayOf(1)),
|
|
arrayOf(arrayOf(1)),
|
|
arrayOf(stringList),
|
|
stringList,
|
|
objectList,
|
|
stringStringList,
|
|
objectList)
|
|
|
|
val returnedList = lib.returnErasureTest()
|
|
lib.paramErasureTest<Int>(listOf("Hello"))
|
|
|
|
// Check trap labelling consistency for methods that instantiate a generic type
|
|
// with its own generic parameters -- for example, class MyList<T> { void addAll(MyList<T> l) { } },
|
|
// which has the trap labelling oddity of looking like plain MyList, not MyList<T>, even though
|
|
// this is a generic instantiation.
|
|
val takesSelfTest = GenericTest<String>()
|
|
takesSelfTest.takesSelfMethod(takesSelfTest)
|
|
|
|
}
|