[jboss-jira] [JBoss JIRA] (DROOLS-4377) Comparison error with primitive and Map in executable-model

Toshiya Kobayashi (Jira) issues at jboss.org
Tue Jul 30 04:32:00 EDT 2019


Toshiya Kobayashi created DROOLS-4377:
-----------------------------------------

             Summary: Comparison error with primitive and Map in executable-model
                 Key: DROOLS-4377
                 URL: https://issues.jboss.org/browse/DROOLS-4377
             Project: Drools
          Issue Type: Bug
          Components: executable model
    Affects Versions: 7.24.0.Final
            Reporter: Toshiya Kobayashi
            Assignee: Luca Molteni


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

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

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.

{noformat}
[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]]
{noformat}

Non executable-model has no issue with the rule.




--
This message was sent by Atlassian Jira
(v7.12.1#712002)


More information about the jboss-jira mailing list