Details
-
Type:
Bug
-
Status:
Closed
-
Priority:
Major
-
Resolution: Won't Fix
-
Affects Version/s: 1.0, 1.1-beta-1
-
Fix Version/s: 1.1-beta-2
-
Component/s: None
-
Labels:None
-
Number of attachments :
Description
When one writes something like Object == null, the behavior implemented in DefaultTypeTransformation.compareEqual() has 2 shortcomings.
1. If you have a Wrapper instance, the instance rather than the wrappered value is compared. I would have thought that wrapper == whatever is equivalent to wrapper.unwrap() == whatever.
2. Along the same lines, the short circuit check for null value on the left and right side doesn't seem right. It makes sense for the left side, however if the left side is an object, and the right side is null, the object should make the determination. This would fix #1 as well.
to 1)
I guess you mean the wrapper defined in Groovy by the wrapper package... could you please post an running example showing this. You should not come into contact with a wrapper unless you write a MetaClass, and in that case it is your task to unwrap. These wrappers are no classic wrappers in the sense that other languages are using, they are not there to represent values of the runtime and to allow faster invocation paths or something like that. they are there to keep a static type during a method call, nothing more... They might become obsolete in 2.0
to 2)
if null==x is ok, then why is x==null not? shouldn't equals be symetric? And why would it fix #1?
I really need a test case to see what you are talking about