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

Alessio Stalla astalla at common-lisp.net
Wed Aug 5 18:16:59 UTC 2009


Author: astalla
Date: Wed Aug  5 14:16:57 2009
New Revision: 12083

Log:
Fixed (reverted) wrong implementation of JavaObject.javaInstance(Class)
introduced with revision 12081.
Fixed incorrect wrapping of LispObjects that are elements of a Java array when
the array is inspected.


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

Modified: trunk/abcl/src/org/armedbear/lisp/JavaObject.java
==============================================================================
--- trunk/abcl/src/org/armedbear/lisp/JavaObject.java	(original)
+++ trunk/abcl/src/org/armedbear/lisp/JavaObject.java	Wed Aug  5 14:16:57 2009
@@ -176,12 +176,7 @@
 
     @Override
     public Object javaInstance(Class c) throws ConditionThrowable {
-	if(obj != null && !c.isAssignableFrom(obj.getClass())) {
-	    return error(new LispError("The value " + obj +
-				       " is not of class " + c.getName()));
-	} else {
-	    return javaInstance();
-	}
+	return javaInstance();
     }
 
     /** Returns the encapsulated Java object for
@@ -263,7 +258,7 @@
 		int length = Array.getLength(obj);
 		for(int i = 0; i < length; i++) {
 		    parts = parts.push
-			(new Cons(empty, new JavaObject(Array.get(obj, i))));
+			(new Cons(empty, JavaObject.getInstance(Array.get(obj, i))));
 		}
 		parts = parts.nreverse();
 	    } else {
@@ -284,7 +279,9 @@
 		@Override
 		public LispObject execute(LispObject arg)
 		    throws ConditionThrowable {
-		    Class<?> c = (Class) arg.javaInstance(Class.class);
+		    //No possibility of type error - we're mapping this function
+		    //over a list of classes
+		    Class<?> c = (Class) arg.javaInstance();
 		    for(Field f : c.getDeclaredFields()) {
 			LispObject value = NIL;
 			try {




More information about the armedbear-cvs mailing list