down the function stack, in order to format later a
String
. However I keep getting
IllegalFormatConversionException
Copy code
logDebug("WindowRef %08X", ref.id) // ref.id is an Int
fun logDebug(fmt: String, vararg args: Any) {
val toAppend = fmt.format(args) // IllegalFormatConversionException
...
}
i
ilya.gorbunov
02/21/2020, 6:37 PM
Try to pass them with the spread operator:
*args
e
elect
02/21/2020, 6:41 PM
it worked..
elect
02/21/2020, 6:41 PM
why is this necessary since
format
also accept vararg?
t
tseisel
02/21/2020, 8:54 PM
vararg Any
is not a type in itself, it becomes an
Array<Any>
once used, so you need to pass this array using the spread operator