score:0

the method you are calling is probably a variadic function. in other words, it expects a variable number of arguments. these parameters are known as repeated parameters in scala, and are often referred to as varags. for example, you can call:

pmdmain(arg1, arg2, arg3)

notice how this is different from pmdmain(list(arg1, arg2, arg3)) – the former has multiple arguments of type string, and the latter has a single argument of type list[string]. the error you are hitting indicates that the first argument in the list is expected to be a string, but you provided an array[string].

if you want to call the method with an instantiated list of arguments, you have to use the special sequence argument notation:

pmdmain(args: _*)

you can read more about repeated parameters and sequence arguments here in the spec.

if you want to play around with this in the repl, you can recreate the error quite simply:

def foo(args: string*) = ??? //the * indicates that args is variadic
foo("bar", "baz") //ok
foo(list("foo", "baz")) //bad
foo(list("foo", "baz"):_*) //ok

Related Query

More Query from same tag