Files
kotlin/compiler/testData/codegen/boxWithStdlib/dataClasses/copy/paramWithoutProperty.kt
Alexander Udalov 128c938965 Make Array.size() a function instead of a property
Also add a deprecated extension property to help migration. This is done to
unify getting size of arrays and collections
2014-11-17 15:02:38 +03:00

18 lines
590 B
Kotlin

data class A(a: Int, b: String) {}
fun box() : String {
for (method in javaClass<A>().getDeclaredMethods()) {
if (method.getName() == "copy"){
val parameterTypes = method.getParameterTypes()
if (parameterTypes != null && parameterTypes.size() == 2) {
val copy = A(1, "a").copy(a = 2, b = "b")
return "OK"
}
else {
return "Method copy has " + (if (parameterTypes == null) "0" else parameterTypes.size()) + " parameters, expected 2"
}
}
}
return "fail"
}