Uploaded image for project: 'Drools'
  1. Drools
  2. DROOLS-2928

Wrong division calculation in Mvel Jitted constraint

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Done
    • Icon: Major Major
    • None
    • 7.10.0.Final
    • core engine

      For a constraint like "age > ((2*$age1)/3) ", Mvel Jitting generates a class like:

      public class ConditionEvaluator251ed544c9124e1d99d3a8cae5048e1a
          implements ConditionEvaluator
      {
      
          public boolean evaluate(InternalFactHandle internalfacthandle, InternalWorkingMemory internalworkingmemory, Tuple tuple)
          {
              Tuple tuple1 = tuple;
              int i = declarations[0].getIntValue(internalworkingmemory, tuple1.getFactHandle().getObject());
              return ((Person)internalfacthandle.getObject()).getAge() > 2 * i * 3;
          }
      
          public ConditionEvaluator251ed544c9124e1d99d3a8cae5048e1a(Declaration adeclaration[])
          {
              declarations = adeclaration;
          }
      
          private static final String EXPRESSION = "age > ((2*$age1)/3)";
          private final Declaration declarations[];
      }
      

      The division is wrongly generated like "getAge() > 2 * i * 3".

              mfusco@redhat.com Mario Fusco
              rhn-support-tkobayas Toshiya Kobayashi
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

                Created:
                Updated:
                Resolved: