[armedbear-devel] Seamless ABCL / Java integration proposal

Mark Evenson evenson at panix.com
Sun Feb 17 17:08:36 UTC 2013


On 2/17/13 1:53 AM, Alan Ruttenberg wrote:

>[…] Also I think there's one remaining bug with
> method look up that we've reported that I don't think is addressed yet. 

[…]

I think you are referring to [#259][] for which the status is that your
original form

    (jss:jarray-to-list (java:jnew-array (jclass "int") 40))

has been working for some time.

[#259]: http://trac.common-lisp.net/armedbear/ticket/259

The equivalent form not utilizing JSS, namely

    (jstatic "asList" "java.util.Arrays" (java:jnew-array (jclass "int") 1))

still fails.  The problems stem from how Java-the-language erases
parametrized type information at runtime, and how the JAVA package
currently tries to match arguments and how it coerces arrays of
primitives (it currently doesn't implicitly).

As a workaround, don't use arrays of primitive types, instead using the
"boxed" Java type:

    (jstatic "asList" "java.util.Arrays" (java:jnew-array (jclass
"java.lang.Integer") 1))

There should be negligible speed differentials on contemporary JVM
implementations from what I understand, and if you were that worried
about memory, you wouldn't be using Java in the first place, now would you?

-- 

"A screaming comes across the sky.  It has happened before, but there is
nothing to compare it to now."






More information about the armedbear-devel mailing list