Bioclipse manager method to take arbitrary number of arguments

I needed a Bioclipse manager method that could take an arbitrary number of arguments, (for a general purpose prolog method mapper). Through a useful discussion with jonalv, we figured out that there exists at least one working way of doing this, while there are a number of ways that do not work across both the Rhino/JavaScript though they work in Java alone.

Working version

This is the only way I got working:

Java method

public ReturnType yourMethod( String[] args ) {
 ...

Calling it from Bioclipse JavaScript environment

var result = yourplugin.yourMethod( [ "arg1", "arg2", "arg3", ... ] );

The square brackets are important, since they make the list of "arguments" into an array, that is sent as one single argument.
You could also of course do:
var args = [ "arg1", "arg2", "arg3", ... ];
var result = yourplugin.yourMethod( args );

Non working ways

What I did also try, which did not work, was for example the following Java method signature:

public ReturnType yourMethod( String argument1, String argument2, String[] args ) {
 ...

and calling from JavaScript like so:

var result = yourplugin.yourMethod( "arg1", "arg2, [ "arg3", "arg4", "arg5", ... ] );

(Tried a few other combinations too, without success)

Comments

Recorded?

I think it is reasonable to assume this can get recorded properly, as it is easy to see how a String[] should be serialized...

However, with parameters, it's more like key-value pairs, ... I can see this implemented as String[n], where n=0,2,4,6,... (or n=2*m, where m := non-negative integer). As Jonathan mentioned on the mailing list, a Map does not properly get recorded...

Parameters in R-style

I have always wanted map-like input in R-syntax, but this has never been feasible. So to have a set of default params that could be overridden:

   myMethod(param1="ola", param7=42);

Without parsing parameter list, this is not possible. Would be interesting if Groovy (or some other scripting language) has solved this...

I can report that this most

I can report that this most likely can be done using Groovy. At least to my understanding.