Let
def h(a: AnyRef*) = a.mkString(\",\")
h: (a: AnyRef*)String
and so
h(\"1\",\"2\")
res: String = 1,2
H
Cast your variable to AnyRef by doing something like this:
h(1.asInstanceOf[AnyRef], 2.asInstanceOf[AnyRef])
Why?
In scala not everything extends Object (aka AnyRef) in the way that it would in java. Specifically primitives extend AnyVal, so if your function requires an AnyRef you'll need to cast / convert / restrict your scala variables.
There's a good discussion here: What are the relationships between Any, AnyVal, AnyRef, Object and how do they map when used in Java code?