Patch from Bob Jervis (bjervis@google.com):
Patch from Bob Jervis (bjervis@google.com):

In reading the LiveConnect spec, it looks like Mark's problem with overloading
methods is due to a bug in Rhino with respect to how LiveConnect is
implemented.

In NativeJavaObject.java, the getConversionWeight method has the case for
JSTYPE_JAVA_ARRAY and JSTYPE_JAVA_OBJECT shares common code.  In the
LiveConnect 3 spec, section 3.3.6.1 describes wrapped Java objects, and 3.3.6.2
describes wrapped Java arrays.  Mark has a wrapped Java array of byte.

He is trying to call a method that has an overload of byte[] and for byte as
well.  It is reporting an ambiguous choice, which is why we needed the syntax
for selecting the overload.  BUt it looks like this should not be necessary.

According to the spec, you can pass a wrapped Java object to a primitive (non
boolean) type, but you cnnot do so for a wrapped Java array.  Around line 366
in my version of the file, there is a test to account for the JSTYPE_JAVA_ARRAY
for passing to a primitive type.  It looks to me like it should return
CONVERSION_NONE for a wrapped array, but it is returning CONVERSION_NONTRIVIAL.
The relevant lines of code are:

        case JSTYPE_JAVA_OBJECT:
        case JSTYPE_JAVA_ARRAY:
            Object javaObj = fromObj;
            if (javaObj instanceof Wrapper) {
                javaObj = ((Wrapper)javaObj).unwrap();
            }
            if (to.isInstance(javaObj)) {
                return CONVERSION_NONTRIVIAL;
            }
            if (to == ScriptRuntime.StringClass) {
                return 2;
            }
            else if (to.isPrimitive() && to != Boolean.TYPE) {
                return (fromCode == JSTYPE_JAVA_ARRAY)
                       ? CONVERSION_NONTRIVIAL : 2 + getSizeRank(to);
            }
            break;

lv7777/egit_test,ashwinrayaprolu1984/rhino,tuchida/rhino,tntim96/rhino-jscover,qhanam/rhino,ashwinrayaprolu1984/rhino,sainaen/rhino,qhanam/rhino,swannodette/rhino,InstantWebP2P/rhino-android,swannodette/rhino,AlexTrotsenko/rhino,lv7777/egit_test,jsdoc3/rhino,Pilarbrist/rhino,tejassaoji/RhinoCoarseTainting,swannodette/rhino,sam/htmlunit-rhino-fork,ashwinrayaprolu1984/rhino,lv7777/egit_test,tntim96/htmlunit-rhino-fork,Pilarbrist/rhino,tejassaoji/RhinoCoarseTainting,tejassaoji/RhinoCoarseTainting,tntim96/rhino-jscover-repackaged,lv7777/egit_test,swannodette/rhino,sainaen/rhino,InstantWebP2P/rhino-android,tntim96/rhino-jscover,lv7777/egit_test,Pilarbrist/rhino,tntim96/rhino-apigee,ashwinrayaprolu1984/rhino,tntim96/rhino-apigee,tejassaoji/RhinoCoarseTainting,Pilarbrist/rhino,tuchida/rhino,tntim96/htmlunit-rhino-fork,AlexTrotsenko/rhino,sainaen/rhino,Pilarbrist/rhino,Angelfirenze/rhino,Angelfirenze/rhino,jsdoc3/rhino,lv7777/egit_test,ashwinrayaprolu1984/rhino,sainaen/rhino,Angelfirenze/rhino,Angelfirenze/rhino,sam/htmlunit-rhino-fork,ashwinrayaprolu1984/rhino,Distrotech/rhino,tuchida/rhino,AlexTrotsenko/rhino,tntim96/rhino-jscover-repackaged,lv7777/egit_test,Pilarbrist/rhino,AlexTrotsenko/rhino,sainaen/rhino,sam/htmlunit-rhino-fork,Pilarbrist/rhino,sainaen/rhino,tuchida/rhino,sam/htmlunit-rhino-fork,Angelfirenze/rhino,tejassaoji/RhinoCoarseTainting,tuchida/rhino,swannodette/rhino,tuchida/rhino,AlexTrotsenko/rhino,rasmuserik/rhino,Angelfirenze/rhino,sainaen/rhino,qhanam/rhino,tntim96/rhino-apigee,sam/htmlunit-rhino-fork,rasmuserik/rhino,Angelfirenze/rhino,tejassaoji/RhinoCoarseTainting,qhanam/rhino,AlexTrotsenko/rhino,swannodette/rhino,sam/htmlunit-rhino-fork,jsdoc3/rhino,tejassaoji/RhinoCoarseTainting,tuchida/rhino,AlexTrotsenko/rhino,sam/htmlunit-rhino-fork,swannodette/rhino,Distrotech/rhino,ashwinrayaprolu1984/rhino