[armedbear-devel] TYPE-ERROR #<java.lang.String foo {BADEAFFE}> cannot be coerced to a string.
Mario Lang
mlang at delysid.org
Sat Jun 12 13:40:04 UTC 2010
Hi.
Just stumbled across this one when I tried to use STRING-EQUAL
to compare a value I received via JINTERFACE-IMPLEMENTATION.
Now, it appears to be very simple to allow the expression
(string (jnew "java.lang.String" "foo"))
by overriding STRING() in JavaObject and checking if obj is a (java) String.
What do you think?
Index: src/org/armedbear/lisp/JavaObject.java
===================================================================
--- src/org/armedbear/lisp/JavaObject.java (revision 12751)
+++ src/org/armedbear/lisp/JavaObject.java (working copy)
@@ -108,6 +108,14 @@
return super.typep(type);
}
+ @Override
+ public LispObject STRING()
+ {
+ if (obj instanceof String)
+ return new SimpleString(obj.toString());
+ return super.STRING();
+ }
+
public final Object getObject()
{
return obj;
--
CYa,
⡍⠁⠗⠊⠕
More information about the armedbear-devel
mailing list