It appears that Object.class and obj.getClass() do not return the same Class instance. SuperWaba documentation does not make any guarentees about (nor mentions) these two aspects, however, due to these differences, hashing these values (in a waba.util.Hashtable) gives unexpected results (also hashing obj.getClass() gives unexpected results).
The following code reproduces this problem:
Object obj = new Object();
if (obj.getClass() == Object.class) {
Vm.debug("same!");
}
else {
Vm.debug("not same!");
}
if (obj.getClass() == obj.getClass()) {
Vm.debug("same here!");
}
else {
Vm.debug("not same here!");
}
When run in the JDK the results are (and waba.util.Hashtable works as expected):
same!
same here!
When run on Palm OS (Kyocera 7135) (and waba.util.Hashtable returns nulls for repeated get()s when the key in the hash is the Class instance):
not same!
not same here!
Thanks,
Dan
Logged In: YES
user_id=180823
Originator: NO
Hi,
I reproduced the bug. Unfortunately, it can't be fixed in SuperWaba. I'll fix it in TotalCross.
thanks for pointing it out.
guich