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

String vs Number Coercion behavior difference between standard-drl and exec-model

XMLWordPrintable

    • 2020 Week 52-03 (from Dec 21)
    • 4
    • Undefined
    • NEW
    • NEW
    • ---
    • ---

      If there is a constraint to compare String with Number, standard-drl (MvelConstraint) coerces String to Number so the evaluation will be Number comparison (e.g. 10 > 5). But exec-model coerces Number to String so the evaluation will be String comparison (e.g. "10" < "5").

      Note that we need to use Object or Map to test this because simple comparison String vs Number causes a compilation error.

      for example)

          ObjectHolder($o : value)
          StringHolder( value > $o )
      

      or

          $map : Map()
          StringHolder( value > $map.get("key") )
      

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

              Created:
              Updated:
              Resolved: