Any plans to implement variable args in Kotlin which could be used in place of arrays.
For ex: @RequestMapping (method=)
from Spring MVC accepts array.
In Java, you could simply do @RequestMapping(method=RequestMethod.POST)
In Kotlin, only way to do it is @RequestMapping(method=arrayOf(RequestMethod.POST))
Wouldn’t it be nice to do it Java way for this?
Note that variable arguments is part of the language, not with 3 dots but with the vararg
keyword, see https://kotlinlang.org/docs/reference/functions.html#variable-number-of-arguments-varargs
Existing arrays can be used as a parameter by using the spread operator *
, see the same link.
The case that hasn’t been covered is your annotation example for which there is an issue in the tracker https://youtrack.jetbrains.com/issue/KT-10063