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

Arithmetic operation with String coercion in constraint fails in executable-model

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Done
    • Icon: Major Major
    • 7.69.0.Final
    • 7.68.0.Final
    • executable model
    • None
    • 2022 Week 14-16 (from Apr 4), 2022 Week 17-19 (from Apr 25)
    • 2
    • NEW
    • NEW
    • ---
    • ---

      rule R1
      dialect "mvel"
      when
        StrBdHolder($str: str, bd == $str * -1)
      then
      end
      

      Fails with

      The operator * is undefined for the argument type(s) String, int
      

      generated code

      public enum LambdaExtractorA01091D610A021769F6F9F5A86246BC8 implements org.drools.model.functions.Function1<java.lang.String, java.lang.Object>, org.drools.model.functions.HashedExpression {
         ...
          @Override()
          public java.lang.Object apply(java.lang.String $str) {
              return $str * -1;
          }
      }
      

              rhn-support-tkobayas Toshiya Kobayashi
              rhn-support-tkobayas Toshiya Kobayashi
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

                Created:
                Updated:
                Resolved: