[armedbear-devel] [PATCH] Problems with new JavaObject.javaInstance(Class c) and JSS

Mark Evenson evenson at panix.com
Wed Aug 5 15:17:40 UTC 2009


Unfortunately Alessio's (and Tobias?) work on [adding richness to 
inspection of Java objects][1] contains a bug that manifests itself in 
stopping [JSS][2] from working.

The attached patch gets JSS to run again, but I am not sure the right 
way to fix the problem in the trunk, mainly as I don't understand all of 
our conversion rules, and how they interact with Java's autoboxing.

The problem with JSS occurs when JavaObject.javaInstance(Class c) is 
invoked with a Class from a primitive boolean on an JavaObject that 
wraps a java.lang.Boolean.  The call to 
java.lang.Class.isAssignableFrom() has an oddly (to me) specific 
contract that "[i]if [the] Class object represents a primitive type, 
this method returns true if the specified Class parameter is exactly 
this Class object; otherwise it returns false."  This makes 
JavaObject<java.lang.Boolean>.javaInstance(boolean) fail, when 
everything seems to work fine if we simply return the wrapped object.

What I don't understand mainly is if boolean/java.lang.Boolean objects 
are somehow special in our treatment of them, or should we do this for 
all of the other primitive types?

[1]: http://trac.common-lisp.net/armedbear/changeset/12081

[2]: http://mumble.net:8080/svn/lsw/trunk/jss/


-- 
"A screaming comes across the sky.  It has happened before, but there
is nothing to compare to it now."
-------------- next part --------------
A non-text attachment was scrubbed...
Name: java-instance-primitive-types.diff
Type: text/x-diff
Size: 1892 bytes
Desc: not available
URL: <https://mailman.common-lisp.net/pipermail/armedbear-devel/attachments/20090805/8272be8f/attachment.diff>


More information about the armedbear-devel mailing list