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

Alessio Stalla astalla at common-lisp.net
Mon Jul 19 21:04:24 UTC 2010


Author: astalla
Date: Mon Jul 19 17:04:23 2010
New Revision: 12813

Log:
Java interop, small improvement: the first argument to jnew can now also be a jclass reference.


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	Mon Jul 19 17:04:23 2010
@@ -523,7 +523,19 @@
 		if(classRef instanceof AbstractString) {
 		    constructor = findConstructor(javaClass(classRef), args);
 		} else {
-		    constructor = (Constructor) JavaObject.getObject(classRef);
+		    Object object = JavaObject.getObject(classRef);
+		    if(object instanceof Constructor) {
+			constructor = (Constructor) object;
+		    } else if(object instanceof Class<?>) {
+			constructor = findConstructor((Class<?>) object, args);
+		    } else {
+			return type_error(classRef,
+					  list(Symbol.OR,
+					       list(Symbol.JCLASS,
+						    new SimpleString("java.lang.reflect.Constructor")),
+					       list(Symbol.JCLASS,
+						    new SimpleString("java.lang.Class"))));
+		    }
 		}
                 Class[] argTypes = constructor.getParameterTypes();
                 Object[] initargs = new Object[args.length-1];




More information about the armedbear-cvs mailing list