On Jun 12, 6:45 am, chris idr <[EMAIL PROTECTED]> wrote:
> I am sending in this code to the evaluate method
> String code = "java.lang.System.out.println(util.printd(\"mmmm d,
> yyyy\", new Date()));";
> Object result = cx.evaluateString(scope, code, "test", 1, null);
>
> but it is then calling printd(int, Date) and NOT printd(String, Date)
>
> Is this a bug in rhino, or is there something I need to do?
>
> Chris

Everything else being equal, Rhino should prefer printd(String, Date)
over printd(int, Date) given a call with a String and a Date.

A quick check for me works fine:

import java.util.Date;
public class Test {
  public String printd(String s, Date d) { return "String"; }
  public String printd(int i, Date d) { return "int"; }
}

js> var t = new Packages.Test();
var t = new Packages.Test();
js> t.printd("String", new java.util.Date());
String

Could something else be going on? Are both methods public?

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

Reply via email to