Details
-
Bug
-
Resolution: Done
-
Major
-
None
-
7.57.0.Final
-
None
-
2021 Week 31-33 (from Aug 2)
-
1
-
Undefined
-
NEW
-
NEW
Description
DowncastTest failure with github action build chain with JDK 11.
2021-07-30T01:29:14.7504741Z [INFO] Running org.drools.modelcompiler.DowncastTest^M 2021-07-30T01:29:14.8600124Z [ERROR] Tests run: 2, Failures: 1, Errors: 0, Skipped: 0, Time elapsed: 0.103 s <<< FAILURE! - in org.drools.modelcompiler.DowncastTest^M 2021-07-30T01:29:14.8613263Z [ERROR] testDowncast[PATTERN_DSL](org.drools.modelcompiler.DowncastTest) Time elapsed: 0.071 s <<< FAILURE!^M 2021-07-30T01:29:14.8614666Z java.lang.AssertionError: ^M 2021-07-30T01:29:14.8616630Z [Message [id=1, level=ERROR, path=src/main/java/defaultpkg/PC7/LambdaPredicateC7132C1CB78C0B6BB21618E128BE427C.java, line=24, column=1141^M 2021-07-30T01:29:14.8662458Z text=The method abs(int) in the type Math is not applicable for the arguments (BigDecimal)], Message [id=2, level=ERROR, path=src/main/java/defaultpkg/PC7/LambdaPredicateC7132C1CB78C0B6BB21618E128BE427C.java, line=0, column=0^M 2021-07-30T01:29:14.8664448Z text=Java source of src/main/java/defaultpkg/PC7/LambdaPredicateC7132C1CB78C0B6BB21618E128BE427C.java in error:^M 2021-07-30T01:29:14.8665758Z package defaultpkg.PC7;^M 2021-07-30T01:29:14.8666212Z ^M 2021-07-30T01:29:14.8765381Z import static defaultpkg.RulesEACB0BBC98102A3BB31497B07EDB3CFC.*;^M 2021-07-30T01:29:14.8766935Z import org.drools.modelcompiler.DowncastTest.Product;^M 2021-07-30T01:29:14.8768524Z import org.drools.modelcompiler.DowncastTest.LoanProduct;^M 2021-07-30T01:29:14.8769909Z import org.drools.modelcompiler.DowncastTest.CashProduct;^M 2021-07-30T01:29:14.8771263Z import org.drools.modelcompiler.DowncastTest.Proposal;^M 2021-07-30T01:29:14.8772196Z import defaultpkg.*;^M 2021-07-30T01:29:14.8778692Z import org.drools.modelcompiler.dsl.pattern.D;^M 2021-07-30T01:29:14.8780560Z ^M 2021-07-30T01:29:14.8791294Z @org.drools.compiler.kie.builder.MaterializedLambda()^M 2021-07-30T01:29:14.8801243Z public enum LambdaPredicateC7132C1CB78C0B6BB21618E128BE427C implements org.drools.model.functions.Predicate2<org.drools.modelcompiler.DowncastTest.Proposal, org.drools.modelcompiler.DowncastTest.Proposal>, org.drools.model.functions.HashedExpression {^M 2021-07-30T01:29:14.8804739Z ^M 2021-07-30T01:29:14.8817664Z INSTANCE;^M 2021-07-30T01:29:14.8818115Z ^M 2021-07-30T01:29:14.8818845Z public static final String EXPRESSION_HASH = "7BA6F742C2F27BFB31ACFB94B400757C";^M 2021-07-30T01:29:14.8819442Z ^M 2021-07-30T01:29:14.8820052Z public java.lang.String getExpressionHash() {^M 2021-07-30T01:29:14.8820908Z return EXPRESSION_HASH;^M 2021-07-30T01:29:14.8821406Z }^M 2021-07-30T01:29:14.8821756Z ^M 2021-07-30T01:29:14.8822233Z @Override()^M 2021-07-30T01:29:14.8841926Z public boolean test(org.drools.modelcompiler.DowncastTest.Proposal _this, org.drools.modelcompiler.DowncastTest.Proposal $cp) throws java.lang.Exception {^M 2021-07-30T01:29:14.8852307Z return org.drools.modelcompiler.util.EvaluationUtil.greaterThanNumbers(Math.abs(((LoanProduct) _this.getProduct()).getLoanValue().subtract(((CashProduct) $cp.getProduct()).getCashValue()).divide(((CashProduct) $cp.getProduct()).getCashValue())), 3l);^M 2021-07-30T01:29:14.8861296Z }^M 2021-07-30T01:29:14.8861705Z ^M 2021-07-30T01:29:14.8862159Z @Override()^M 2021-07-30T01:29:14.8863185Z public org.drools.model.functions.PredicateInformation predicateInformation() {^M 2021-07-30T01:29:14.8880898Z return new org.drools.model.functions.PredicateInformation("Math.abs((((LoanProduct)product).loanValue.subtract(((CashProduct)$cp.product).cashValue)).divide(((CashProduct)$cp.product).cashValue)) > 3", "R", "r0.drl");^M 2021-07-30T01:29:14.8882308Z }^M 2021-07-30T01:29:14.8882742Z }^M 2021-07-30T01:29:14.8883137Z ]]^M 2021-07-30T01:29:14.8883891Z at org.junit.Assert.fail(Assert.java:89)^M 2021-07-30T01:29:14.8885311Z at org.drools.modelcompiler.BaseModelTest.createKieBuilder(BaseModelTest.java:155)^M 2021-07-30T01:29:14.8887110Z at org.drools.modelcompiler.BaseModelTest.createKieBuilder(BaseModelTest.java:130)^M 2021-07-30T01:29:14.8905609Z at org.drools.modelcompiler.BaseModelTest.getKieContainer(BaseModelTest.java:119)^M 2021-07-30T01:29:14.8908650Z at org.drools.modelcompiler.BaseModelTest.getKieContainer(BaseModelTest.java:112)^M 2021-07-30T01:29:14.8911943Z at org.drools.modelcompiler.BaseModelTest.getKieSession(BaseModelTest.java:108)^M 2021-07-30T01:29:14.8915631Z at org.drools.modelcompiler.BaseModelTest.getKieSession(BaseModelTest.java:104)^M 2021-07-30T01:29:14.8933943Z at org.drools.modelcompiler.DowncastTest.testDowncast(DowncastTest.java:33)^M
The generated code was:
return org.drools.modelcompiler.util.EvaluationUtil.greaterThanNumbers(Math.abs(((LoanProduct) _this.getProduct()).getLoanValue().subtract(((CashProduct) $cp.getProduct()).getCashValue()).divide(((CashProduct) $cp.getProduct()).getCashValue())), 3l);
But it should add .doubleValue()
return org.drools.modelcompiler.util.EvaluationUtil.greaterThanNumbers(Math.abs(((LoanProduct) _this.getProduct()).getLoanValue().subtract(((CashProduct) $cp.getProduct()).getCashValue()).divide(((CashProduct) $cp.getProduct()).getCashValue()).doubleValue()), 3.0);