-
Bug
-
Resolution: Done
-
Major
-
6.5.0.Final
-
None
-
None
-
2017 Week 36-37
-
NEW
-
NEW
I got a DRL compilation error on accessing through a generic type property. Minimized object definition is below.
public interface OrderLine<T extends Product> { T getProduct(); } public interface Product { String getId(); String getCategory(); } // and I have concrete classes, ex. Book, BookOrderLine<Book>, DVD, DVDOrderLine<DVD>, ... etc
DRL(snippet) is here
when
$orderLine: OrderLine()
// compilation failed
Product(
id == $orderLine.product.id || category == $orderLine.product.category
) from discountProducts
This causes below exception.
java.lang.RuntimeException: [Message [id=1, kieBase=defaultKieBase, level=ERROR, path=rules/checkorder-not-compiled.drl, line=15, column=0 text=Unable to Analyse Expression id == $orderLine.product.id || category == $orderLine.product.category:
[Error: unable to resolve method using strict-mode: java.lang.Object.category()]
[Near :
Unknown macro: {... Line.product.id || category == $orderLine.product.category ....}
]
^
[Line: 15, Column: 2]]]
This is weird because it won't occur when the restriction has single condition like below. Drools could analyze this expression.
when
$orderLine: OrderLine()
// this is compiled, even if `Product(id == $orderLine.product.id)`
Product(
category == $orderLine.product.category
) from discountProducts