[armedbear-cvs] r13328 - trunk/abcl/src/org/armedbear/lisp

mevenson at common-lisp.net mevenson at common-lisp.net
Tue Jun 14 10:05:04 UTC 2011


Author: mevenson
Date: Tue Jun 14 03:05:04 2011
New Revision: 13328

Log:
Fix JNEW-ARRAY-FROM-ARRAY to create byte[] arrays.

Modified:
   trunk/abcl/src/org/armedbear/lisp/Java.java

Modified: trunk/abcl/src/org/armedbear/lisp/Java.java
==============================================================================
--- trunk/abcl/src/org/armedbear/lisp/Java.java	Tue Jun 14 02:20:56 2011	(r13327)
+++ trunk/abcl/src/org/armedbear/lisp/Java.java	Tue Jun 14 03:05:04 2011	(r13328)
@@ -709,7 +709,14 @@
                 LispObject v = args[1];
                 for (int i = 2; i<args.length - 1; i++)
                     a = Array.get(a, ((Integer)args[i].javaInstance()).intValue());
-                Array.set(a, ((Integer)args[args.length - 1].javaInstance()).intValue(), v.javaInstance());
+                Object value = v.javaInstance();
+                int index = ((Integer)args[args.length - 1].javaInstance()).intValue();
+                if (value instanceof java.lang.Number
+                    && a.getClass().getComponentType().equals(Byte.TYPE)) {
+                    Array.setByte(a, index, ((java.lang.Number)value).byteValue());
+                } else {
+                    Array.set(a, index, value);
+                }
                 return v;
             }
             catch (Throwable t) { // no code -> no ControlTransfer




More information about the armedbear-cvs mailing list