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

compile error in exec model when setting BigDecimal variable to String type property

    XMLWordPrintable

Details

    • Bug
    • Status: Verified (View Workflow)
    • Major
    • Resolution: Done
    • 7.10.1.GA
    • 7.11.1.GA
    • BRE
    • None
    • Red Hat Decision Manager 7.10.1

    • CR1
    • Hide

      run attached reproducer by 'mvn clean compile".
      It works if it 's run by 'mvn clean compile exec:exec -DgenerateModel=NO"

      Show
      run attached reproducer by 'mvn clean compile". It works if it 's run by 'mvn clean compile exec:exec -DgenerateModel=NO"
    • 2021 Week 19-21 (from May 10), 2021 Week 22-24 (from May 31)
    • +

    Description

      Compile fails with the error in executable model when setting BigDecimal type variable to String type property in RHS.

      Here is example of rules.

      Example Rule 1

      rule "rule cannot find symbol 2"
          when
              $fact : Fact( $bd: bd )
          then
              $fact.text = $bd;
              System.out.println("***** $fact.text = "+$fact.text);
      end
      

      Compilation error :

      [ERROR] /path/to/reproducer_set_bigdecimal_to_string/target/generated-sources/drools-model-compiler/main/java/com/example/reproducer/PDB/LambdaConsequenceDB86D1D027F981C570371BD3694D10F6.java:[25,14] cannot find symbol
      [ERROR]   symbol:   variable text
      [ERROR]   location: variable $fact of type com.example.reproducer.Fact
      

      In this example, problematic property 'text' is not real property name, but only setter/getter are defined like the following.

          public String getText() {
              return getStr();
          }
      
          public void setText(String str) {
              setStr(str);
          }
      

      Example Rule 2

      rule "rule_set_bd_to_str"
          no-loop true
          when
              $fact : Fact( $bd: bd )
          then
              $fact.str = $bd;
              System.out.println("***** $fact.str = "+$fact.str);
      end
      

      Compilation error :

      [ERROR] /path/to/reproducer_set_bigdecimal_to_string/target/generated-sources/drools-model-compiler/main/java/com/example/reproducer/PFC/LambdaConsequenceFC4DFA1CB831E1940CE9B37A0C925678.java:[25,14] str has private access in com.example.reproducer.Fact
      [ERROR] /path/to/reproducer_set_bigdecimal_to_string/target/generated-sources/drools-model-compiler/main/java/com/example/reproducer/PFC/LambdaConsequenceFC4DFA1CB831E1940CE9B37A0C925678.java:[25,21] incompatible types: java.math.BigDecimal cannot be converted to java.lang.String
      

      Attachments

        Issue Links

          Activity

            People

              lmolteni@redhat.com Luca Molteni
              rhn-support-hmiura Hiroko Miura
              Daniel Rosa Daniel Rosa
              Votes:
              0 Vote for this issue
              Watchers:
              4 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: