[jboss-jira] [JBoss JIRA] (DROOLS-1724) DRL compilation error on a generic type property
Mario Fusco (JIRA)
issues at jboss.org
Thu Sep 7 13:21:00 EDT 2017
[ https://issues.jboss.org/browse/DROOLS-1724?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Mario Fusco updated DROOLS-1724:
--------------------------------
Sprint: 2017 Week 36-37
> DRL compilation error on a generic type property
> ------------------------------------------------
>
> Key: DROOLS-1724
> URL: https://issues.jboss.org/browse/DROOLS-1724
> Project: Drools
> Issue Type: Bug
> Affects Versions: 6.5.0.Final
> Environment: drools 6.5.0.Final / java 1.8.0_131
> Reporter: Ryo Murai
> Assignee: Mario Fusco
> Fix For: 7.3.1.Final
>
>
> I got a DRL compilation error on accessing through a generic type property. Minimized object definition is below.
> {code:borderStyle=solid}
> 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
> {code}
> DRL(snippet) is here
> {code:borderStyle=solid}
> when
> $orderLine: OrderLine()
> // compilation failed
> Product(
> id == $orderLine.product.id || category == $orderLine.product.category
> ) from discountProducts
> {code}
> This causes below exception.
> {panel}
> 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 : {... Line.product.id || category == $orderLine.product.category ....}]
> ^
> [Line: 15, Column: 2]]]
> {panel}
> This is weird because it won't occur when the restriction has single condition like below. Drools could analyze this expression.
> {code:borderStyle=solid}
> when
> $orderLine: OrderLine()
> // this is compiled, even if `Product(id == $orderLine.product.id)`
> Product(
> category == $orderLine.product.category
> ) from discountProducts
> {code}
--
This message was sent by Atlassian JIRA
(v7.2.3#72005)
More information about the jboss-jira
mailing list