[armedbear-ticket] [armedbear] #259: jss:jarray-to-list fails
![](https://secure.gravatar.com/avatar/bfc2df4941985c6757bb9cc05a33e95f.jpg?s=120&d=mm&r=g)
#259: jss:jarray-to-list fails --------------------------------------------+------------------------------- Reporter: https://openid.fau.de/eg74yneg | Owner: mevenson Type: defect | Status: new Priority: major | Milestone: Component: abcl-contrib | Version: Keywords: | --------------------------------------------+------------------------------- CL-USER> * #<jarray [B@5719d1 {15F987F}> CL-USER> (jss:jarray-to-list *) ========== no such method [Condition of type ERROR] Restarts: 0: [RETRY] Retry SLIME REPL evaluation request. 1: [ABORT] Return to sldb level 1. 2: [RETRY] Retry SLIME REPL evaluation request. 3: [*ABORT] Return to SLIME's top level. 4: [ABORT] Abort thread. Backtrace: 0: (#<FUNCTION {149EEF3}> #<ERROR {E6942E}> #<FUNCTION {149EEF3}>) 1: (APPLY #<FUNCTION {149EEF3}> (#<ERROR {E6942E}> #<FUNCTION {149EEF3}>)) 2: (SYSTEM::RUN-HOOK SYSTEM::*INVOKE-DEBUGGER-HOOK* #<ERROR {E6942E}> #<FUNCTION {149EEF3}>) 3: (INVOKE-DEBUGGER #<ERROR {E6942E}>) 4: org.armedbear.lisp.Lisp.error(Lisp.java:382) 5: org.armedbear.lisp.Java.jstatic(Java.java:462) 6: org.armedbear.lisp.Java$pf_jstatic.execute(Java.java:512) 7: org.armedbear.lisp.Primitive.execute(Primitive.java:135) 8: (JSS:JARRAY-TO-LIST #<jarray [B@5719d1 {15F987F}>) 9: (SYSTEM::%EVAL (JSS:JARRAY-TO-LIST *)) 10: (EVAL (JSS:JARRAY-TO-LIST *)) 11: (SWANK::EVAL-REGION "(jss:jarray-to-list *) ") -- Ticket URL: <http://trac.common-lisp.net/armedbear/ticket/259> armedbear <http://common-lisp.net/project/armedbear> armedbear
![](https://secure.gravatar.com/avatar/bfc2df4941985c6757bb9cc05a33e95f.jpg?s=120&d=mm&r=g)
#259: jss:jarray-to-list fails --------------------------------------------+------------------------------- Reporter: https://openid.fau.de/eg74yneg | Owner: mevenson Type: defect | Status: new Priority: major | Milestone: Component: abcl-contrib | Version: Keywords: | --------------------------------------------+------------------------------- Comment(by https://openid.fau.de/eg74yneg): Simplest test-case: {{{ (jss:jarray-to-list (java:jnew-array (jclass "int") 40)) }}} -- Ticket URL: <http://trac.common-lisp.net/armedbear/ticket/259#comment:1> armedbear <http://common-lisp.net/project/armedbear> armedbear
![](https://secure.gravatar.com/avatar/bfc2df4941985c6757bb9cc05a33e95f.jpg?s=120&d=mm&r=g)
#259: jss:jarray-to-list fails --------------------------------------------+------------------------------- Reporter: https://openid.fau.de/eg74yneg | Owner: mevenson Type: defect | Status: accepted Priority: major | Milestone: 1.1.0 Component: abcl-contrib | Version: 1.1.0-dev Keywords: | --------------------------------------------+------------------------------- Changes (by mevenson): * status: new => accepted * version: => 1.1.0-dev * milestone: => 1.1.0 Comment: Maybe something screwed up in our type mapping for JAVA-OBJECT. (java :jnew-array (jclass "int") 40) creates a JAVA-OBJECT whose intendedType is int[]. The code in java.isApplicableMethod() signals that java.lang.Arrays.asList(Object[]) is not an applicable method although the following code outputs "true" indicating that it should be matched, as it is successfully applicable. {{{ int i[] = {new Integer(40)}; Object[] type = {1}; Class clazz = type.getClass(); System.out.println(clazz.getComponentType().isInstance(i)); }}} I tried fixing Java.isApplicableMethod() but it didn't work out in the time I had. I have a simpler fix for JSS:JARRAY-TO-LIST which doesn't involve resolving this problem which I will commit shortly, but am noting the possibly deeper problem for followup. -- Ticket URL: <http://trac.common-lisp.net/armedbear/ticket/259#comment:2> armedbear <http://common-lisp.net/project/armedbear> armedbear
![](https://secure.gravatar.com/avatar/bfc2df4941985c6757bb9cc05a33e95f.jpg?s=120&d=mm&r=g)
#259: jss:jarray-to-list fails --------------------------------------------+------------------------------- Reporter: https://openid.fau.de/eg74yneg | Owner: mevenson Type: defect | Status: accepted Priority: major | Milestone: 1.1.0 Component: abcl-contrib | Version: 1.1.0-dev Keywords: | --------------------------------------------+------------------------------- Comment(by mevenson): (In [14226]) Re #259: fix JSS:JLIST-TO-LIST. This fixes the immediate problem, but leave the ticket open as far as I can tell the following code fails in ABCL, but succeeds in the equivalent Java code indicating we need to fix Java.isApplicableMethod(): (jstatic "asList" "java.util.Arrays" (java:jnew-array (jclass "int") 1)) -- Ticket URL: <http://trac.common-lisp.net/armedbear/ticket/259#comment:3> armedbear <http://common-lisp.net/project/armedbear> armedbear
![](https://secure.gravatar.com/avatar/bfc2df4941985c6757bb9cc05a33e95f.jpg?s=120&d=mm&r=g)
#259: JAVA:JSTATIC cannot always be invoked properly --------------------------------------------+------------------------------- Reporter: https://openid.fau.de/eg74yneg | Owner: mevenson Type: defect | Status: accepted Priority: major | Milestone: 1.1.0 Component: abcl-contrib | Version: 1.1.0-dev Keywords: | --------------------------------------------+------------------------------- Old description:
CL-USER> * #<jarray [B@5719d1 {15F987F}> CL-USER> (jss:jarray-to-list *)
==========
no such method [Condition of type ERROR]
Restarts: 0: [RETRY] Retry SLIME REPL evaluation request. 1: [ABORT] Return to sldb level 1. 2: [RETRY] Retry SLIME REPL evaluation request. 3: [*ABORT] Return to SLIME's top level. 4: [ABORT] Abort thread.
Backtrace: 0: (#<FUNCTION {149EEF3}> #<ERROR {E6942E}> #<FUNCTION {149EEF3}>) 1: (APPLY #<FUNCTION {149EEF3}> (#<ERROR {E6942E}> #<FUNCTION {149EEF3}>)) 2: (SYSTEM::RUN-HOOK SYSTEM::*INVOKE-DEBUGGER-HOOK* #<ERROR {E6942E}> #<FUNCTION {149EEF3}>) 3: (INVOKE-DEBUGGER #<ERROR {E6942E}>) 4: org.armedbear.lisp.Lisp.error(Lisp.java:382) 5: org.armedbear.lisp.Java.jstatic(Java.java:462) 6: org.armedbear.lisp.Java$pf_jstatic.execute(Java.java:512) 7: org.armedbear.lisp.Primitive.execute(Primitive.java:135) 8: (JSS:JARRAY-TO-LIST #<jarray [B@5719d1 {15F987F}>) 9: (SYSTEM::%EVAL (JSS:JARRAY-TO-LIST *)) 10: (EVAL (JSS:JARRAY-TO-LIST *)) 11: (SWANK::EVAL-REGION "(jss:jarray-to-list *) ")
New description: The following doesn't work {{{ (jstatic "asList" "java.util.Arrays" (java:jnew-array (jclass "int") 1)) }}} The question is: should it? CL-USER> * #<jarray [B@5719d1 {15F987F}> CL-USER> (jss:jarray-to-list *) ========== no such method [Condition of type ERROR] Restarts: 0: [RETRY] Retry SLIME REPL evaluation request. 1: [ABORT] Return to sldb level 1. 2: [RETRY] Retry SLIME REPL evaluation request. 3: [*ABORT] Return to SLIME's top level. 4: [ABORT] Abort thread. Backtrace: 0: (#<FUNCTION {149EEF3}> #<ERROR {E6942E}> #<FUNCTION {149EEF3}>) 1: (APPLY #<FUNCTION {149EEF3}> (#<ERROR {E6942E}> #<FUNCTION {149EEF3}>)) 2: (SYSTEM::RUN-HOOK SYSTEM::*INVOKE-DEBUGGER-HOOK* #<ERROR {E6942E}> #<FUNCTION {149EEF3}>) 3: (INVOKE-DEBUGGER #<ERROR {E6942E}>) 4: org.armedbear.lisp.Lisp.error(Lisp.java:382) 5: org.armedbear.lisp.Java.jstatic(Java.java:462) 6: org.armedbear.lisp.Java$pf_jstatic.execute(Java.java:512) 7: org.armedbear.lisp.Primitive.execute(Primitive.java:135) 8: (JSS:JARRAY-TO-LIST #<jarray [B@5719d1 {15F987F}>) 9: (SYSTEM::%EVAL (JSS:JARRAY-TO-LIST *)) 10: (EVAL (JSS:JARRAY-TO-LIST *)) 11: (SWANK::EVAL-REGION "(jss:jarray-to-list *) ") -- Comment(by mevenson): Things seem rather complicated with Java the language generics. A method that takes an Object[] as an argument {{{ public static void objectArgs(Object[] args) }}} cannot be invoked on an array of primitive types {{{ int i[] = {42}; objectArgs(i); // Doesn't compile }}} But the signature of the method originally in question declares the type of array to extend java.lang.Object: {{{ public static <T extends Object> List<T> asList(T[] ts) }}} and *can* be invoked on an array of primitive types {{{ int i[] = {42}; java.util.Arrays.asList(i); }}} Need to check exactly what kind of code is generated by javac here, but presumably the compiler somehow transforms the primitive array to wrapped type here? So, JAVA:JSTATIC cannot make currently make a call that can be made in Java the language. Presumably JAVA:JCALL has the same sort of problem From experimenting a bit, it would not be enough to fix Java.isApplicableMethod(). We would also at least have to extend Java.javaInstance(Class<?>) to return arrays of primitive types. -- Ticket URL: <http://trac.common-lisp.net/armedbear/ticket/259#comment:4> armedbear <http://common-lisp.net/project/armedbear> armedbear
![](https://secure.gravatar.com/avatar/bfc2df4941985c6757bb9cc05a33e95f.jpg?s=120&d=mm&r=g)
#259: JAVA:JSTATIC cannot always be invoked properly --------------------------------------------+------------------------------- Reporter: https://openid.fau.de/eg74yneg | Owner: mevenson Type: defect | Status: accepted Priority: major | Milestone: 1.1.0 Component: abcl-contrib | Version: 1.1.0-dev Keywords: | --------------------------------------------+------------------------------- Old description:
The following doesn't work
{{{ (jstatic "asList" "java.util.Arrays" (java:jnew-array (jclass "int") 1)) }}}
The question is: should it?
CL-USER> * #<jarray [B@5719d1 {15F987F}> CL-USER> (jss:jarray-to-list *)
==========
no such method [Condition of type ERROR]
Restarts: 0: [RETRY] Retry SLIME REPL evaluation request. 1: [ABORT] Return to sldb level 1. 2: [RETRY] Retry SLIME REPL evaluation request. 3: [*ABORT] Return to SLIME's top level. 4: [ABORT] Abort thread.
Backtrace: 0: (#<FUNCTION {149EEF3}> #<ERROR {E6942E}> #<FUNCTION {149EEF3}>) 1: (APPLY #<FUNCTION {149EEF3}> (#<ERROR {E6942E}> #<FUNCTION {149EEF3}>)) 2: (SYSTEM::RUN-HOOK SYSTEM::*INVOKE-DEBUGGER-HOOK* #<ERROR {E6942E}> #<FUNCTION {149EEF3}>) 3: (INVOKE-DEBUGGER #<ERROR {E6942E}>) 4: org.armedbear.lisp.Lisp.error(Lisp.java:382) 5: org.armedbear.lisp.Java.jstatic(Java.java:462) 6: org.armedbear.lisp.Java$pf_jstatic.execute(Java.java:512) 7: org.armedbear.lisp.Primitive.execute(Primitive.java:135) 8: (JSS:JARRAY-TO-LIST #<jarray [B@5719d1 {15F987F}>) 9: (SYSTEM::%EVAL (JSS:JARRAY-TO-LIST *)) 10: (EVAL (JSS:JARRAY-TO-LIST *)) 11: (SWANK::EVAL-REGION "(jss:jarray-to-list *) ")
New description: The following doesn't work {{{ (jstatic "asList" "java.util.Arrays" (java:jnew-array (jclass "int") 1)) }}} -- Comment(by mevenson): Replying to [comment:1 https://openid.fau.de/eg74yneg]:
Simplest test-case: {{{ (jss:jarray-to-list (java:jnew-array (jclass "int") 40)) }}}
Text of the original report: CL-USER> * #<jarray [B@5719d1 {15F987F}> CL-USER> (jss:jarray-to-list *) ========== no such method [Condition of type ERROR] Restarts: 0: [RETRY] Retry SLIME REPL evaluation request. 1: [ABORT] Return to sldb level 1. 2: [RETRY] Retry SLIME REPL evaluation request. 3: [*ABORT] Return to SLIME's top level. 4: [ABORT] Abort thread. Backtrace: 0: (#<FUNCTION {149EEF3}> #<ERROR {E6942E}> #<FUNCTION {149EEF3}>) 1: (APPLY #<FUNCTION {149EEF3}> (#<ERROR {E6942E}> #<FUNCTION {149EEF3}>)) 2: (SYSTEM::RUN-HOOK SYSTEM::*INVOKE-DEBUGGER-HOOK* #<ERROR {E6942E}> #<FUNCTION {149EEF3}>) 3: (INVOKE-DEBUGGER #<ERROR {E6942E}>) 4: org.armedbear.lisp.Lisp.error(Lisp.java:382) 5: org.armedbear.lisp.Java.jstatic(Java.java:462) 6: org.armedbear.lisp.Java$pf_jstatic.execute(Java.java:512) 7: org.armedbear.lisp.Primitive.execute(Primitive.java:135) 8: (JSS:JARRAY-TO-LIST #<jarray [B@5719d1 {15F987F}>) 9: (SYSTEM::%EVAL (JSS:JARRAY-TO-LIST *)) 10: (EVAL (JSS:JARRAY-TO-LIST *)) 11: (SWANK::EVAL-REGION "(jss:jarray-to-list *) ") -- Ticket URL: <http://trac.common-lisp.net/armedbear/ticket/259#comment:5> armedbear <http://common-lisp.net/project/armedbear> armedbear
![](https://secure.gravatar.com/avatar/bfc2df4941985c6757bb9cc05a33e95f.jpg?s=120&d=mm&r=g)
#259: JAVA:JSTATIC cannot always be invoked properly --------------------------------------------+------------------------------- Reporter: https://openid.fau.de/eg74yneg | Owner: mevenson Type: defect | Status: accepted Priority: major | Milestone: 1.1.1 Component: java | Version: 1.1.0-dev Keywords: java-interop needs-audit | --------------------------------------------+------------------------------- Changes (by mevenson): * keywords: => java-interop needs-audit * component: abcl-contrib => java * milestone: 1.1.0 => 1.1.1 -- Ticket URL: <http://trac.common-lisp.net/armedbear/ticket/259#comment:6> armedbear <http://common-lisp.net/project/armedbear> armedbear
![](https://secure.gravatar.com/avatar/bfc2df4941985c6757bb9cc05a33e95f.jpg?s=120&d=mm&r=g)
#259: JAVA:JSTATIC cannot always be invoked properly --------------------------------------------+------------------------------- Reporter: https://openid.fau.de/eg74yneg | Owner: mevenson Type: defect | Status: accepted Priority: critical | Milestone: 1.2.0 Component: java | Version: 1.1.0-dev Keywords: java-interop needs-audit | --------------------------------------------+------------------------------- Changes (by mevenson): * priority: major => critical * milestone: 1.1.1 => 1.2.0 -- Ticket URL: <http://trac.common-lisp.net/armedbear/ticket/259#comment:7> armedbear <http://common-lisp.net/project/armedbear> armedbear
participants (1)
-
armedbear