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

Exec model compilation fails when comparing BigDecimal and String

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Done
    • Icon: Major Major
    • 7.13.0.GA
    • 7.12.0.GA
    • BRE
    • RHDM 7.12.0

    • False
    • False
    • Release Notes
    • ER1
    • +
    • Hide

      build project 'kjarCreation' in attached reproducer

      Show
      build project 'kjarCreation' in attached reproducer
    • 2022 Week 05-07 (from Jan 31)

      KJAR build fails with executable model when comparing BigDecimal type and String type property like the following.

      rule "rule_compare_bd_and_str"
          no-loop true
          when
              $fact : Fact( $bd: bd )
              $code : Code( id == $bd )
          then
              System.out.println("***** $fact = "+$fact+", $code = "+$code);
      end
      

      In Fact class, bd is BigDecimal type property.
      In Code class. id is String type property.

      Executable model build fails with the following error:

      [ERROR] Failed to execute goal org.kie:kie-maven-plugin:7.59.0.Final-redhat-00006:generateModel (default-generateModel) on project kjarCreation: Execution default-generateModel of goal org.kie:kie-maven-plugin:7.59.0.Final-redhat-00006:generateModel failed: [com/example/reproducer/P22/LambdaExtractor22353C40A1384D56E5C5AEF7CBBEECB5.java (25:858) : Cannot cast from BigDecimal to String] -> [Help 1]
      

      and here is the problematic generated source code which causes above ERROR.

      @Override()
      public java.lang.Object apply(java.math.BigDecimal $bd)

      { return (java.lang.String) $bd; }

      Non-executable model build succeeds with above rule.
      In addition, executable model build also succeeds with version 7.11.1.(7.52.0.Final-redhat-00008)

              mfusco@redhat.com Mario Fusco
              rhn-support-hmiura Hiroko Miura
              Daniel Rosa Daniel Rosa
              Daniel Rosa Daniel Rosa
              Votes:
              0 Vote for this issue
              Watchers:
              6 Start watching this issue

                Created:
                Updated:
                Resolved: