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

executable-model fails with BigDecimal arithmetic when it's a scope of a method call

    XMLWordPrintable

Details

    • Bug
    • Resolution: Done
    • Major
    • 8.36.0.Final
    • 7.67.0.Final, 7.73.0.Final, 8.35.0.Final
    • executable model
    • None
    • 2023 Week 09-11 (from Feb 27)
    • 2
    • NEW
    • NEW
    • ---
    • ---

    Description

      Customer( $ans : String.format("%,d", (rate * new BigDecimal("1000")).longValue()) )   // "rate" is a BigDecimal property of Customer class
      

      fails with exec-model while successful with non-exec-model

      java.lang.AssertionError: [Message [id=1, level=ERROR, path=src/main/java/org/drools/modelcompiler/bigdecimals/P14/LambdaExtractor14CE93CA77415634448D1C7EC1BB172A.java, line=22, column=936
         text=The operator * is undefined for the argument type(s) BigDecimal, long], Message [id=2, level=ERROR, path=src/main/java/org/drools/modelcompiler/bigdecimals/P14/LambdaExtractor14CE93CA77415634448D1C7EC1BB172A.java, line=0, column=0
         text=Java source of src/main/java/org/drools/modelcompiler/bigdecimals/P14/LambdaExtractor14CE93CA77415634448D1C7EC1BB172A.java in error:
      
      ...
      
          @Override()
          public java.lang.String apply(org.drools.modelcompiler.bigdecimaltest.Customer _this) {
              return String.format("%,d", _this.getRate() * new BigDecimal("1000").longValue());
          }
      }
      ]]
      	at org.drools.modelcompiler.BaseModelTest.createKieBuilder(BaseModelTest.java:154)
      	at org.drools.modelcompiler.BaseModelTest.createKieBuilder(BaseModelTest.java:129)
      	at org.drools.modelcompiler.BaseModelTest.getKieContainer(BaseModelTest.java:118)
      	at org.drools.modelcompiler.BaseModelTest.getKieContainer(BaseModelTest.java:111)
      	at org.drools.modelcompiler.BaseModelTest.getKieSession(BaseModelTest.java:107)
      	at org.drools.modelcompiler.BaseModelTest.getKieSession(BaseModelTest.java:103)
      	at org.drools.modelcompiler.bigdecimaltest.BigDecimalTest.bigDecimalArithmeticWithMthodCall(Unknown Source)
      

      Attachments

        Issue Links

          Activity

            People

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

              Dates

                Created:
                Updated:
                Resolved: