Changeset 12831
- Timestamp:
- 07/28/10 22:13:15 (13 years ago)
- Location:
- trunk/abcl/src/org/armedbear/lisp
- Files:
-
- 1 added
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/abcl/src/org/armedbear/lisp/JavaObject.java
r12755 r12831 98 98 if (type == BuiltInClass.JAVA_OBJECT) 99 99 return T; 100 if(type.typep(LispClass.findClass(JAVA_CLASS, false)) != NIL) { 100 LispObject cls = NIL; 101 if(type instanceof Symbol) { 102 cls = LispClass.findClass(type, false); 103 } 104 if(cls == NIL) { 105 cls = type; 106 } 107 if(cls.typep(LispClass.findClass(JAVA_CLASS, false)) != NIL) { 101 108 if(obj != null) { 102 Class c = (Class) JAVA_CLASS_JCLASS.execute( type).javaInstance();109 Class c = (Class) JAVA_CLASS_JCLASS.execute(cls).javaInstance(); 103 110 return c.isAssignableFrom(obj.getClass()) ? T : NIL; 104 111 } else { 105 112 return T; 106 113 } 114 } else if(cls == BuiltInClass.SEQUENCE) { 115 //This information is replicated here from java.lisp; it is a very 116 //specific case, not worth implementing CPL traversal in typep 117 if(java.util.List.class.isInstance(obj) || 118 java.util.Set.class.isInstance(obj)) { 119 return T; 120 } 107 121 } 108 122 return super.typep(type); 109 123 } 110 111 124 112 125 @Override -
trunk/abcl/src/org/armedbear/lisp/compile-system.lisp
r12624 r12831 187 187 ;;"j.lisp" 188 188 "java.lisp" 189 "java-collections.lisp" 189 190 "known-functions.lisp" 190 191 "known-symbols.lisp" -
trunk/abcl/src/org/armedbear/lisp/java.lisp
r12774 r12831 149 149 method implementation))))) 150 150 lisp-this)) 151 152 (defun jequal (obj1 obj2) 153 "Compares obj1 with obj2 using java.lang.Object.equals()" 154 (jcall (jmethod "java.lang.Object" "equals" "java.lang.Object") 155 obj1 obj2)) 151 156 152 157 (defun jobject-class (obj) … … 364 369 :java-class +java-lang-object+))) 365 370 371 (defun jclass-additional-superclasses (jclass) 372 "Extension point to put additional CLOS classes on the CPL of a CLOS Java class." 373 (let ((supers nil)) 374 (when (jclass-interface-p jclass) 375 (push (find-class 'java-object) supers)) 376 (when (jequal jclass (jclass "java.util.List")) 377 (push (find-class 'sequence) supers)) 378 supers)) 379 366 380 (defun ensure-java-class (jclass) 367 381 (let ((class (%find-java-class jclass))) … … 379 393 (list (jclass-superclass jclass)) 380 394 (jclass-interfaces jclass)))))) 381 (if (jclass-interface-p jclass) 382 (append supers (list (find-class 'java-object))) 383 supers)) 395 (append supers (jclass-additional-superclasses jclass))) 384 396 :java-class jclass))))) 385 397
Note: See TracChangeset
for help on using the changeset viewer.