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

Comparison error with primitive and Map in executable-model

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Done
    • Icon: Major Major
    • None
    • 7.24.0.Final
    • executable model

      When comparing a primitive int with an Integer inside a Map,

      import java.util.Map;
      import org.drools.modelcompiler.domain.Person;
      rule R1 when
          $m : Map()
          Person(age == $m['age'] )
      then
      end
      

      executable-model build fails with "Comparison operation requires compatible types. Found int and class java.lang.Object" even though the Map's value is Integer.

      [ERROR] Failures: 
      [ERROR]   CompilerTest.testMapPrimitiveComparison:1905->BaseModelTest.getKieSession:99->BaseModelTest.getKieSession:103->BaseModelTest.getKieContainer:107->BaseModelTest.getKieContainer:114->BaseModelTest.createKieBuilder:125->BaseModelTest.createKieBuilder:152 [Message [id=1, kieBase=defaultKieBase, level=ERROR, path=r0.drl, line=-1, column=0
         text=Comparison operation requires compatible types. Found int and class java.lang.Object]]
      

      Non executable-model has no issue with the rule.

              lmolteni@redhat.com Luca Molteni
              rhn-support-tkobayas Toshiya Kobayashi
              Tibor Zimányi Tibor Zimányi
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

                Created:
                Updated:
                Resolved: