It looks like there's an issue with caching methods -- the arguments aren't being taken into account. We're using the following as a temporary workaround version of invoke-find-method:<div><br></div><div><div>(defun invoke-find-method (method object args)</div>

<div>  (let ((jmethod nil)); (get-jmethod method object)))</div><div>    (unless jmethod</div><div>      (setf jmethod </div><div>            (if (symbolp object)</div><div>                ;;; static method</div><div>                (apply #'jmethod (lookup-class-name object) </div>

<div>                       method (mapcar #'jobject-class args))</div><div>                  ;;; instance method</div><div>                (apply #'jresolve-method </div><div>                       method object args)))</div>

<div>      (if (null jmethod) (error "There's no method ~A with the signature ~A" method (cons object args)))</div><div>      (jcall +set-accessible+ jmethod +true+))</div><div>      ;;(set-jmethod method object jmethod))</div>

<div>    jmethod))</div><div><br></div><br><div class="gmail_quote">On Sun, Apr 1, 2012 at 1:33 PM, Mark Evenson <span dir="ltr"><<a href="mailto:evenson@panix.com">evenson@panix.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">

<div class="HOEnZb"><div class="h5">On 3/31/12 12:14 AM, Jonathan P. Bona wrote:<br>
</div></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div><div class="h5">
Alan pointed out a JSS issue with passing of immediate values that may<br>
be related to the bug (report just sent) causing<br>
(jss::invoke-find-method "substring" "this is a string" '(1))  to<br>
return #<method public java.lang.String<br>
java.lang.String.substring(<u></u>int,int)><br>
<br>
Here are some of Alan's comments on this:<br>
<br>
Previously, in the old version of JSS:<br>
(new 'Boolean t) ->  #<java.lang.Boolean true {19FD541}><br>
<br>
Now:<br>
(new 'Boolean t) ->  #<THREAD "interpreter" {4C4A0D}>: Debugger invoked<br>
on condition of type JAVA-EXCEPTION<br>
   Java exception 'java.lang.<u></u>NoSuchMethodException:<br>
Boolean(org.armedbear.lisp.<u></u>Symbol)'.<br>
Restarts:<br>
   0: TOP-LEVEL Return to top level.<br>
<br>
Notice that it has not translated the "t" to true as it used to. If<br>
method lookup is also not doing this then it makes sense that the<br>
method isn't found.<br>
(#"booleanValue" +true+) ->  t<br>
(#"valueOf" 'Boolean +true+) ->  t<br>
(#"valueOf" 'Boolean t) ->  error<br>
<br>
So it is clear that t isn't being coerced to boolean, which is done in<br>
method invoke-restargs in the old invoke.lisp:<br>
<br>
(dolist (arg args)<br>
                        (setf (jarray-ref argv (incf (the fixnum i)))<br>
                             (if (eq arg t) true (if (eq arg nil) false arg))))<br>
<br>
<br>
But I still don't understand why (#"valueOf" 'Boolean +true+)  works.<br>
Here's the declaration: public static java.lang.Boolean<br>
java.lang.Boolean.valueOf(<u></u>boolean)<br>
<br>
Apparently the compiler will unbox the Boolean to boolean for a method<br>
call. It doesn't for a method lookup I think. So they must have code<br>
for checking for both Boolean and boolean in the method signature when<br>
looking up the method.<br>
<br>
Only theory I have is that lookup of static methods is different from<br>
lookup of instance methods.<br>
<br>
<br>
On Fri, Mar 30, 2012 at 5:36 PM, Jonathan P. Bona<br>
<<a href="mailto:jonathanbona@gmail.com" target="_blank">jonathanbona@gmail.com</a>>  wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
I'm working with Alan Ruttenberg to port LSW from the old version of<br>
JSS to the JSS that is now part of abcl-contrib.<br>
<br>
We've run into the following bug when using with-constant-signature:<br>
<br>
; these first two work fine:<br>
(#"substring" "some string" 2 4)  ; "me"<br>
(#"substring" "some string" 2)     ; "me string"<br>
<br>
; and so does this<br>
(with-constant-signature ((substring "substring")) (substring "some<br>
string" 2 4))   ; "me"<br>
<br>
; but this breaks:<br>
(with-constant-signature ((substring "substring")) (substring "some string" 2))<br>
; Wrong number of arguments for public java.lang.String<br>
java.lang.String.substring(<u></u>int,int): expected 2, got 1<br>
;   [Condition of type PROGRAM-ERROR]<br>
<br>
<br>
A problem seems to be in jss::invoke-find-method, which is finding the<br>
two argument version of java.lang.String.substring no matter how many<br>
arguments its given:<br>
<br>
(jss::invoke-find-method "substring" "this is a string" '(1))  ;<br>
should return the java.lang.String.substring method with one int arg<br>
; #<method public java.lang.String java.lang.String.substring(<u></u>int,int)><br>
<br>
(jss::invoke-find-method "substring" "this is a string" '(1 2) )<br>
; #<method public java.lang.String java.lang.String.substring(<u></u>int,int)><br>
<br>
(jss::invoke-find-method "substring" "this is a string" '(1 2 3 4 5 6<br>
7 8) )  ; should be an error<br>
; #<method public java.lang.String java.lang.String.substring(<u></u>int,int)><br>
<br>
<br>
<br>
<br>
- Jonathan Bona<br>
</blockquote>
<br></div></div>
______________________________<u></u>_________________<br>
armedbear-devel mailing list<br>
<a href="mailto:armedbear-devel@common-lisp.net" target="_blank">armedbear-devel@common-lisp.<u></u>net</a><br>
<a href="http://lists.common-lisp.net/cgi-bin/mailman/listinfo/armedbear-devel" target="_blank">http://lists.common-lisp.net/<u></u>cgi-bin/mailman/listinfo/<u></u>armedbear-devel</a><br>
<br>
</blockquote>
Filed as [ticket][#205].  As soon as I write some tests to convince myself of the right cases to implement we should have this working for you in a couple days.  It vaguely smells like a problem left over from the graft from the jscheme arity matcher with a CL:APPLY.<br>


<br>
At a minimum we should at least throw a condition with some args to inspect as to why we failed to match the plausible candidates which passed case insensitive string matching on the function names.<br>
<br>
[#205]: <a href="http://trac.common-lisp.net/armedbear/ticket/205" target="_blank">http://trac.common-lisp.net/<u></u>armedbear/ticket/205</a><span class="HOEnZb"><font color="#888888"><br>
<br>
-- <br>
"A screaming comes across the sky.  It has happened before, but there<br>
is nothing to compare to it now."<br>
</font></span></blockquote></div><br></div>