Changeset 11834


Ignore:
Timestamp:
05/05/09 22:01:50 (14 years ago)
Author:
astalla
Message:

Relaxed type checking when invoking Java methods from Lisp, as discussed on the mailing list.

Location:
trunk/abcl/src/org/armedbear/lisp
Files:
2 edited

Legend:

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

    r11762 r11834  
    626626            instance = ((JavaObject)instanceArg).getObject();
    627627        else {
    628             type_error(instanceArg,
    629                             list(Symbol.OR, Symbol.STRING, Symbol.JAVA_OBJECT));
    630             // Not reached.
    631             return null;
     628      instance = instanceArg.javaInstance();
    632629        }
    633630        try {
  • trunk/abcl/src/org/armedbear/lisp/LispObject.java

    r11754 r11834  
    103103  {
    104104        return this;
    105     /*return error(new LispError("The value " + writeToString() +
    106                                 " is not of primitive type."));*/
    107105  }
    108106
    109107  public Object javaInstance(Class c) throws ConditionThrowable
    110108  {
    111     if (c == LispObject.class)
    112       return this;
    113     return error(new LispError("The value " + writeToString() +
    114                                 " is not of primitive type."));
     109      if (getClass().isAssignableFrom(c))
     110    return this;
     111      return error(new LispError("The value " + writeToString() +
     112         " is not of class " + c.getName()));
    115113  }
    116114
Note: See TracChangeset for help on using the changeset viewer.