Well, that's cute.<div>with constant signature expands into a call to jss:invoke-find-method called with the arguments to the first function call, saves that, and subsequently always uses jcall to call that specific method. The lookup calls jresolve method then setAccessible on the result. Perhaps it is the setAccessible that is doing the magic?</div>
<div><br></div><div>You should svn update - I've committed some changes elsewhere. I'm dealing with an annoyance - I updated abcl to trunk and am trying java 1.7. I get a startup (fatal) error unless I first delete the slime/swank compiled files. No clue what that's about. If you want you can see if you can reproduce and then file a report. Otherwise I'll get to it.</div>
<div><br></div><div>The java 1.7 I get from the Oracle site. </div><div><br></div><div>-Alan<br><br><div class="gmail_quote">On Wed, Aug 1, 2012 at 12:08 AM, Jonathan P. Bona <span dir="ltr"><<a href="mailto:jonathanbona@gmail.com" target="_blank">jonathanbona@gmail.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Just to follow up on this with a little more info, I've put together a<br>
small example that demonstrates the issue I'm seeing.<br>
<br>
Consider this class "Outer", which includes an inner class "Inner":<br>
<br>
public class Outer {<br>
public static Inner getAnInner(){<br>
return new Inner();<br>
}<br>
<br>
static class Inner{<br>
public Inner(){<br>
}<br>
<br>
public void innerm(){<br>
System.out.println("called innerm");<br>
}<br>
}<br>
}<br>
<br>
In Java, I can instantiate Inner and call its public methods, as in<br>
the following:<br>
<br>
public class TestMain {<br>
public static void main(String[] args){<br>
Outer.Inner myinner = new Outer.Inner();<br>
myinner.innerm();<br>
}<br>
}<br>
<br>
However, in ABCL 1.0.1:<br>
<br>
CL-USER(1): (jnew "Outer$Inner")<br>
#<THREAD "interpreter" {7FB5438D}>: Debugger invoked on condition of<br>
type JAVA-EXCEPTION<br>
Java exception 'java.lang.IllegalAccessException: Class<br>
org.armedbear.lisp.Java$pf_jnew can not access a member of class<br>
Outer$Inner with modifiers "public"'.<br>
<br>
I can still get an instance to play with:<br>
<br>
CL-USER(3): (jstatic "getAnInner" "Outer")<br>
#<Outer$Inner Outer$Inner@67df02c9 {62300F65}><br>
<br>
… but I can't call its public methods:<br>
<br>
CL-USER(6): (jcall "innerm" (jstatic "getAnInner" "Outer"))<br>
#<THREAD "interpreter" {7FB5438D}>: Debugger invoked on condition of<br>
type JAVA-EXCEPTION<br>
Java exception 'java.lang.IllegalAccessException: Class<br>
org.armedbear.lisp.Java can not access a member of class Outer$Inner<br>
with modifiers "public"'.<br>
<br>
… unless I use JSS and with-constant-signature<br>
<br>
CL-USER(7): (require :abcl-contrib)<br>
CL-USER(8): (require :jss)<br>
CL-USER(9): (jss::ensure-compatibility)<br>
CL-USER(10): (with-constant-signature ((innerm "innerm")) (innerm<br>
(jstatic "getAnInner" "Outer"))<br>
)<br>
called innerm<br>
NIL<br>
<br>
<br>
<br>
Any help getting to the bottom of this would be greatly appreciated.<br>
<br>
Regards,<br>
<div class="im HOEnZb">Jonathan<br>
<br>
<br>
On Tue, Jul 31, 2012 at 10:06 PM, Alan Ruttenberg<br>
<<a href="mailto:alanruttenberg@gmail.com">alanruttenberg@gmail.com</a>> wrote:<br>
</div><div class="HOEnZb"><div class="h5">> Hey guys,<br>
><br>
> Have any of you had a chance to look into this? This is a showstopper for me<br>
> using the latest ABCL as I have basic infrastructure code that is failing.<br>
><br>
> Would much appreciate someone having a look.<br>
><br>
> Thanks,<br>
> Alan<br>
><br>
><br>
> On Thu, Jul 19, 2012 at 3:54 PM, Jonathan P. Bona <<a href="mailto:jonathanbona@gmail.com">jonathanbona@gmail.com</a>><br>
> wrote:<br>
>><br>
>> Hello,<br>
>><br>
>> We found this issue while working with LSW. It seems to be a bug in<br>
>> how public methods are found for inner classes. The last line of code<br>
>> below results in an exception rather than finding and running the<br>
>> size() method:<br>
>><br>
>> ;;;----------------<br>
>> (require :abcl-contrib)<br>
>> (require :jss)<br>
>> (jss::ensure-compatibility)<br>
>> (setq headers (#"getHeaderFields" (#"openConnection" (jss::new<br>
>> 'java.net.url "<a href="http://google.com" target="_blank">http://google.com</a>"))))<br>
>><br>
>> ; a java.util.Collections$UnmodifiableRandomAccessList<br>
>> (setq ural (#"get" headers (second (jss::set-to-list (#"keySet"<br>
>> headers)))))<br>
>><br>
>> ;finds: #<method public int<br>
>> java.util.Collections$UnmodifiableCollection.size()><br>
>> (find "size" (#"getMethods" (#"getClass" ural) ) :test 'string-equal<br>
>> :key #"getName")<br>
>><br>
>> ; Java exception 'java.lang.NoSuchMethodException: No applicable<br>
>> method named size found in java.lang.Object or<br>
>> java.util.Collections$UnmodifiableRandomAccessList'.<br>
>> (#"size" ural)<br>
>> ;;;----------------<br>
>><br>
>> I chased this into org.armedbear.lisp.Java, where findMethod is returning<br>
>> null.<br>
>><br>
>> - Jonathan Bona<br>
><br>
><br>
><br>
</div></div><div class="HOEnZb"><div class="h5">> _______________________________________________<br>
> armedbear-devel mailing list<br>
> <a href="mailto:armedbear-devel@common-lisp.net">armedbear-devel@common-lisp.net</a><br>
> <a href="http://lists.common-lisp.net/cgi-bin/mailman/listinfo/armedbear-devel" target="_blank">http://lists.common-lisp.net/cgi-bin/mailman/listinfo/armedbear-devel</a><br>
><br>
</div></div></blockquote></div><br></div>