it appears that a Java method with boolean arguments, e.g.

public void aMethod(boolean x) { ... }

cannot be invoked from Javascript with a Number, i.e.

aMethod(0);

this causes an EvaluatorException: Can't find
method ...aMethod(number).


I see that NativeJavaMethod::getConversionWeight explicitly disallows
the case JSTYPE_NUMBER to primitive Boolean.TYPE...

        case JSTYPE_NUMBER:
            if (to.isPrimitive()) {
                if (to == Double.TYPE) {
                    return 1;
                }
                else if (to != Boolean.TYPE) {
                    return 1 + getSizeRank(to);
                }
            }

what is the rationale for disallowing the conversion of a Number to a
boolean in order to match a method?

_______________________________________________
dev-tech-js-engine-rhino mailing list
[email protected]
https://lists.mozilla.org/listinfo/dev-tech-js-engine-rhino

Reply via email to