Uploaded image for project: 'Red Hat Decision Manager'
  1. Red Hat Decision Manager
  2. RHDM-1966

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

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Done
    • Icon: Major Major
    • 7.13.3.GA
    • 7.12.0.GA, 7.12.1.GA, 7.13.1.GA, 7.13.2.GA
    • BRE
    • False
    • None
    • False
    • CR1
    • +
    • Hide
      $ unzip reproducer_bd_op_in_constraint_1a.zip
      $ cd reproducer_bd_op_in_constraint_1a
      $ ./run_mvn
      === generateModel=NO ===
          :
          :
      ***** start
      ***** Action of Rule "Rule 1a": $ans = 2,000
      ***** end
          :
          :
      
      === generateModel=YES ===
          :
          :
      [ERROR] Failed to execute goal org.kie:kie-maven-plugin:7.67.0.Final-redhat-00019:generateModel (default-generateModel) on project reproducer_bd_op_in_constraint_1a: Execution default-generateModel of goal org.kie:kie-maven-plugin:7.67.0.Final-redhat-00019:generateModel failed: [com/example/reproducer/P2A/LambdaExtractor2A3865EA6CC8B883951F6D08477ECCC6.java (21:795) : The operator * is undefined for the argument type(s) BigDecimal, long] -> [Help 1]
          :
          :
      
      Show
      $ unzip reproducer_bd_op_in_constraint_1a.zip $ cd reproducer_bd_op_in_constraint_1a $ ./run_mvn === generateModel=NO === : : ***** start ***** Action of Rule "Rule 1a": $ans = 2,000 ***** end : : === generateModel=YES === : : [ERROR] Failed to execute goal org.kie:kie-maven-plugin:7.67.0.Final-redhat-00019:generateModel (default-generateModel) on project reproducer_bd_op_in_constraint_1a: Execution default-generateModel of goal org.kie:kie-maven-plugin:7.67.0.Final-redhat-00019:generateModel failed: [com/example/reproducer/P2A/LambdaExtractor2A3865EA6CC8B883951F6D08477ECCC6.java (21:795) : The operator * is undefined for the argument type(s) BigDecimal, long] -> [Help 1] : :
    • 2023 Week 09-11 (from Feb 27), 2023 Week 12-14 (from Mar 20)

      In executable model, build of the following pattern in LHS of a rule fails with error message (*1) for generated Java code (*2). While the same build succeeds in non-executable model.

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

      (*1) Error message

      [ERROR] Failed to execute goal org.kie:kie-maven-plugin:7.67.0.Final-redhat-00019:generateModel (default-generateModel) on project reproducer_bd_op_in_constraint_1a: Execution default-generateModel of goal org.kie:kie-maven-plugin:7.67.0.Final-redhat-00019:generateModel failed: [com/example/reproducer/P2A/LambdaExtractor2A3865EA6CC8B883951F6D08477ECCC6.java (21:795) : The operator * is undefined for the argument type(s) BigDecimal, long] -> [Help 1]
      

      (*2) Java code generated in executable model

      @Override()
      public java.lang.String apply(com.example.reproducer.Fact _this) {
          return String.format("%,d", _this.getValue() * new BigDecimal("1000").longValue());
      }
      

              rhn-support-tkobayas Toshiya Kobayashi
              rhn-support-myoshida Masato Yoshida
              Paolo Bizzarri Paolo Bizzarri
              Paolo Bizzarri Paolo Bizzarri
              Votes:
              0 Vote for this issue
              Watchers:
              4 Start watching this issue

                Created:
                Updated:
                Resolved: