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

Alessio Stalla alessiostalla at gmail.com
Wed Aug 5 17:39:40 UTC 2009

On Wed, Aug 5, 2009 at 6:25 PM, Mark Evenson<evenson at panix.com> wrote:
> On 8/5/09 5:33 PM, Alessio Stalla wrote:
> […]
>> Also, I have a question about your patch: do you have a specific
>> reason to handle null by always signaling an error? In principle, null
>> is assignable to any non-primitive type, so the type error ought to be
>> signaled only for primitive types, imho.
> No good reason: I was just trying to refactor the logic, but misunderstood
> your intent (that "null is assignable to any non-primitive type") so it is
> incorrect as it stands.

Ok. Looking at my commit again, I see that actually the change to
javaInstance() is not particularly useful for the inspection of Java
objects; it just makes code a little bit shorter in
getInspectedFields(), where a type check is not done explicitly,
relying on javaInstance() to do it. So the safest thing to do is to
revert my change and do the type check, until we sort out precisely
how to correctly implement javaInstance(Class). I also believe this
method should be generified, in order to avoid an unnecessary cast of
its return value from Object to the desired type.


More information about the armedbear-devel mailing list