[armedbear-cvs] r13398 - trunk/abcl/contrib/jss
mevenson at common-lisp.net
mevenson at common-lisp.net
Tue Jul 12 14:28:02 UTC 2011
Author: mevenson
Date: Tue Jul 12 07:28:01 2011
New Revision: 13398
Log:
JSS:JLIST-TO-LIST now works for types implementing java.util.List.
Unclear as to what sort of type JSS:LIST-TO-LIST should work on, so we
restore the previous implementation while marking it as deprecated.
Modified:
trunk/abcl/contrib/jss/invoke.lisp
trunk/abcl/contrib/jss/packages.lisp
Modified: trunk/abcl/contrib/jss/invoke.lisp
==============================================================================
--- trunk/abcl/contrib/jss/invoke.lisp Tue Jul 12 02:21:59 2011 (r13397)
+++ trunk/abcl/contrib/jss/invoke.lisp Tue Jul 12 07:28:01 2011 (r13398)
@@ -551,16 +551,29 @@
collect item)))
(defun jlist-to-list (list)
+ "Convert a LIST implementing java.util.List to a Lisp list."
+ (declare (optimize (speed 3) (safety 0)))
+ (loop :for i :from 0 :below (jcall "size" list)
+ :collecting (jcall "get" list i)))
+
+(defun jarray-to-list (jarray)
+ (declare (optimize (speed 3) (safety 0)))
+ (jlist-to-list
+ (jstatic "asList" "java.util.Arrays" jarray)))
+
+;;; Deprecated
+;;;
+;;; XXX unclear what sort of list this would actually work on, as it
+;;; certainly doesn't seem to be any of the Java collection types
+;;; (what implements getNext())?
+(defun list-to-list (list)
(declare (optimize (speed 3) (safety 0)))
(with-constant-signature ((isEmpty "isEmpty") (getfirst "getFirst")
- (getNext "getNext"))
+ (getNext "getNext"))
(loop until (isEmpty list)
collect (getFirst list)
do (setq list (getNext list)))))
-;;; Deprecated
-(setf (symbol-function 'list-to-list) #'jlist-to-list)
-
;; Contribution of Luke Hope. (Thanks!)
(defun iterable-to-list (iterable)
Modified: trunk/abcl/contrib/jss/packages.lisp
==============================================================================
--- trunk/abcl/contrib/jss/packages.lisp Tue Jul 12 02:21:59 2011 (r13397)
+++ trunk/abcl/contrib/jss/packages.lisp Tue Jul 12 07:28:01 2011 (r13398)
@@ -24,6 +24,7 @@
#:jlist-to-list
#:set-to-list
#:vector-to-list
+ #:jarray-to-list
;;; deprecated
#:get-java-field ; use JAVA:JFIELD
More information about the armedbear-cvs
mailing list