[armedbear-devel] type mismatch for "asList"
Mark Evenson
evenson at panix.com
Fri Aug 19 07:52:38 UTC 2011
On Aug 19, 2011, at 02:08 , Patrice Seyed wrote:
> Hello,
>
> With the following expression:
>
> (#"asList" 'Arrays "test")
>
> I get the error:
>
> Java exception 'SchemeException: java.lang.IllegalArgumentException: argument type mismatch
> ARGUMENT MISMATCH for method
>
> public static java.util.List java.util.Arrays.asList(java.lang.Object[])
> called with ("test")'.
> [Condition of type JAVA-EXCEPTION]
The Arrays.asList() method takes an array of java.lang.Object
("java.lang.Object[]") as a parameter, while you are passing it a
single String ("java.lang.String").
One way to convert the argument to a "java.lang.String[]", which
is a subtype of "java.lang.Object[]" therefore a valid parameter
to Arrays.asList() would be to use JAVA:AVA-ARRAY-FROM-LIST:
CL-USER> (let ((array (jnew-array-from-list "java.lang.String" '("Test"))))
(#"asList" 'Arrays array))
#<java.util.Arrays$ArrayList [Test] {13DA6112}> CL-USER>
--
"A screaming comes across the sky. It has happened before, but there is nothing to compare to it now."
More information about the armedbear-devel
mailing list