Changeset 12813


Ignore:
Timestamp:
07/19/10 21:04:23 (12 years ago)
Author:
astalla
Message:

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

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/abcl/src/org/armedbear/lisp/Java.java

    r12715 r12813  
    524524        constructor = findConstructor(javaClass(classRef), args);
    525525    } else {
    526         constructor = (Constructor) JavaObject.getObject(classRef);
     526        Object object = JavaObject.getObject(classRef);
     527        if(object instanceof Constructor) {
     528      constructor = (Constructor) object;
     529        } else if(object instanceof Class<?>) {
     530      constructor = findConstructor((Class<?>) object, args);
     531        } else {
     532      return type_error(classRef,
     533            list(Symbol.OR,
     534                 list(Symbol.JCLASS,
     535                new SimpleString("java.lang.reflect.Constructor")),
     536                 list(Symbol.JCLASS,
     537                new SimpleString("java.lang.Class"))));
     538        }
    527539    }
    528540                Class[] argTypes = constructor.getParameterTypes();
Note: See TracChangeset for help on using the changeset viewer.