[rules-users] return value restriction: not all expressions supported?

Wolfgang Laun wolfgang.laun at gmail.com
Thu Dec 16 04:12:55 EST 2010


Using 5.1.1 and knowing that "a Return Value restriction is a parenthesized
expression composed from literals, any valid Java primitive or object,
previously bound variables, function calls, and operators" I wrote

  OperatorOrder( $code: code, $id1: elId1, $id2: elId2 )
  CommandCode( code == $code, operands != ( $id1!=null ? ($id2!=null ? 2 :
1) : 0 ) )

and got the erroneous error message:
   Rule Compilation error : [Rule name='operator command: invalid number of
elements']

appl/domain/element/Rule_operator_command__invalid_number_of_elements_0.java
(9:714) : $id2 cannot be resolved

Variations in the return value restriction show that it is the nesting of
-?-:- which causes the bug; a similar (but not equivalent) expression

   operands != ( ($id1!=null ? 1:0) + ($id2!=null ? 1:0) )

is accepted.
-W
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/rules-users/attachments/20101216/e745635f/attachment.html 


More information about the rules-users mailing list