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

BigDecimal and primitive comparison error in executable-model build

    Details

      Description

      When you compare BigDecimal (but the field type is Object) with primitive int,

      import org.drools.modelcompiler.domain.Result;
      rule "rule1"
      when
          $r : Result( value <= 20 )
      then
      end
      

      executable-model build fails.

      [ERROR] Failures: 
      [ERROR]   CompilerTest.testBigDecimalIntCoercion:1901->BaseModelTest.getKieSession:99->BaseModelTest.getKieSession:103->BaseModelTest.getKieContainer:107->BaseModelTest.getKieContainer:114->BaseModelTest.createKieBuilder:125->BaseModelTest.createKieBuilder:152 [Message [id=1, level=ERROR, path=src/main/java/defaultpkg/RulesC992C95703C3473926B5B025D30097DARuleMethods0.java, line=24, column=122
         text=no suitable method found for lessOrEqualNumbers(java.lang.Object,int)
          method org.drools.modelcompiler.util.EvaluationUtil.lessOrEqualNumbers(java.lang.Number,java.lang.Number) is not applicable
            (argument mismatch; java.lang.Object cannot be converted to java.lang.Number)
          method org.drools.modelcompiler.util.EvaluationUtil.lessOrEqualNumbers(java.lang.Long,java.lang.Long) is not applicable
            (argument mismatch; java.lang.Object cannot be converted to java.lang.Long)], Message [id=2, level=ERROR, path=src/main/java/defaultpkg/RulesC992C95703C3473926B5B025D30097DARuleMethods0.java, line=0, column=0
         text=Java source of src/main/java/defaultpkg/RulesC992C95703C3473926B5B025D30097DARuleMethods0.java in error:
      

      Non executable-model works with the rule.

        Gliffy Diagrams

          Attachments

            Issue Links

              Activity

                People

                • Assignee:
                  lucamolteni Luca Molteni
                  Reporter:
                  tkobayashi Toshiya Kobayashi
                  Tester:
                  Tibor Zimanyi
                • Votes:
                  0 Vote for this issue
                  Watchers:
                  3 Start watching this issue

                  Dates

                  • Created:
                    Updated:
                    Resolved: