Subj : Re: Problem with ambiguous method - under Solaris, works in Windows To : Merten Schumann From : Igor Bukanov Date : Fri Aug 13 2004 09:31 pm At the end it turned out to be Rhino bug in code resolving overloaded Java methods. See http://bugzilla.mozilla.org/show_bug.cgi?id=255549 Regards, Igor Igor Bukanov wrote: > Merten Schumann wrote: > >> Hello, >> >> ran into a strange problem: a script works when executed with Sun JDK >> 1.4.2 under Windows but not under Solaris. Besides from the JDK, I used >> the same environment, I mean, my application's .jar, same Rhino js.jar >> ... >> >> Under Solaris, I do get when I call a (public static) method >> getResultSet("bla", null, null) >> >> org.mozilla.javascript.EvaluatorException: >> The choice of Java constructor getResultSet matching JavaScript argument >> types (string,null,null) is ambiguous; candidate constructors are: >> interface de.rochade.srap.ResultSet >> getResultSet(java.lang.String[],java.lang.String[],java.lang.String), >> interface de.rochade.srap.ResultSet >> getResultSet(java.lang.String,java.lang.String,java.lang.String) >> >> According to http://www.mozilla.org/rhino/ScriptingJava.html, I think I >> could understand why Rhino cannot decide due to it's dynamic behaviour >> at Runtime some method overloading things. So, let's say with given >> getResultSet("foo", null, null) >> it cannot decide what to take from >> getResultSet(String, String, String) >> getResult(String[], String[], String) >> (although this would be not nice for me, anyway, I would have a >> work-around for this) >> >> But, the strange thing: if Rhino cannot decide which method to take, why >> is it different under Windows and Solaris??? I think this is an JVM >> issue then ... > > > Hm, what > java.lang.System.out.println(de.rochade.srap.ResultSet.getResultSet.toString()) > would print when executed on Solaris if you add such line to your script > before you call the method? > >> >> When I call getResultSet("foo", "foo", null), it works. That's strange >> too. I mean, if Rhino cannot distinguish String from String[], shouldn't >> it throw "ambiguous" all the time here? Or, does it think "ok, we have >> two Strings here, this can only be the method (String, String, String) >> since in (String[], String[], String) is only one String" :-) > > > It comes from LiveConnect 3.0 specs which Rhino implements, see > > http://www.mozilla.org/js/liveconnect/lc3_method_overloading.html > > Regards, Igor .