I got this Java annotation ad and want to use it in Kotlin
class CurlCommand {
Parameter(names = "-groups", description = "Comma-separated list of group names to be run")
var groups: Array<String>? = null
}
TYPE_MISMATCH compiler reports Required: kotlin.Array <kotlin.String> Found: kotlin.String
Ive tried
Parameter(names = Array<String>(1, {i-> "-groups"}), description = "Comma-separated list of group names to be run")
var groups: Array<String>? = null
and got "Error: (20, 23) Kotlin: annotation parameter must be a compile-time constant"
How can I satisfy the Kotlin compiler?
Java just accepts
@Parameter(names = "-groups", description = "Comma-separated list of group names to be run")
public String groups;
source
share