[rules-users] Trying to compare variables of two objects, not working. (compiles, but not desired result)

Vincent Legendre vincent.legendre at eurodecision.com
Fri Apr 13 06:40:23 EDT 2012


Le 13/04/2012 10:46, Wolfgang Laun a écrit :
> 5.3.0 and 5.4.0.Beta2: Comparing int and Integer fails unless the
> traditional (up to 5.1.1) "return value" construct - parentheses
> around the expression - is used:
>
>   lineItemId == ($lineItem.getID())  // OK
>   lineItemId == ($id)   // OK with $id bound as LineItem( $id: ID>  0 )

Do you mean that this is a new feature since 5.3 and comparing Integer 
worked with values prior to this version ?
This is confusing, as I really though that drools uses equals instead of 
== for String and all "primitives as Object" like Long, Integer and so 
on ...
And this is strange, as in Java, == works with values for Integer, and 
drools is in java ...
And I never faced this problem before, and I am pretty sure that I did 
use Long in tests ... well in fact I was sure before this mail, less now ...

Can you develop more on why this is done this way, and why this is not 
behaving like java ?




More information about the rules-users mailing list