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

"contains" operator behaves inconsistently when used with Maps

    XMLWordPrintable

Details

    • Bug
    • Resolution: Obsolete
    • Major
    • None
    • 5.6.0.Final, 6.0.1.Final, 6.1.0.Final, 6.2.0.CR4
    • None
    • None
    • Workaround Exists
    • Hide

      explicitly use

      Bean( map.containsKey("x") ) // vs. map.containsValue("x")
      

      or

      Bean( map.values() contains "x" ) // vs map.keySet() contains "x"
      
      Show
      explicitly use Bean( map.containsKey( "x" ) ) // vs. map.containsValue( "x" ) or Bean( map.values() contains "x" ) // vs map.keySet() contains "x"

    Description

      In a rule

      Bean( map contains "x" ) // assuming "map" is a property of type Map
      

      "contains" is arbitrarily interpreted as "containsKey"
      The constrain will then fail after being jitted

      The documentation explicitly states that "contains" applies to collections

      Attachments

        Activity

          People

            mfusco@redhat.com Mario Fusco
            dsotty Davide Sottara (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: