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

Alessio Stalla astalla at common-lisp.net
Wed Jun 24 19:14:53 UTC 2009


Author: astalla
Date: Wed Jun 24 15:14:51 2009
New Revision: 12022

Log:
Better type conversion Lisp <-> Java for property getters/setters.


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	(original)
+++ trunk/abcl/src/org/armedbear/lisp/Java.java	Wed Jun 24 15:14:51 2009
@@ -755,7 +755,7 @@
 				if(value instanceof LispObject) {
 				    return (LispObject) value;
 				} else if(value != null) {
-				    return JavaObject.getInstance(value);
+				    return JavaObject.getInstance(value, true);
 				} else {
 				    return NIL;
 				}
@@ -778,15 +778,16 @@
 		obj = javaObject.javaInstance();
 		PropertyDescriptor pd = getPropertyDescriptor(obj, propertyName);
 		Object jValue;
-		if(value == NIL) {
+		//TODO maybe we should do this in javaInstance(Class)
+		if(value instanceof JavaObject) {
+		    jValue = value.javaInstance();
+		} else {
 		    if(Boolean.TYPE.equals(pd.getPropertyType()) ||
 		       Boolean.class.equals(pd.getPropertyType())) {
-			jValue = false;
+			jValue = value != NIL;
 		    } else {
-			jValue = null;
+			jValue = value != NIL ? value.javaInstance() : null;
 		    }
-		} else {
-		    jValue = value.javaInstance();
 		}
 		pd.getWriteMethod().invoke(obj, jValue);
 		return value;




More information about the armedbear-cvs mailing list