[jboss-jira] [JBoss JIRA] (DROOLS-5214) Executable model compilation fails with constraints containing static method calls
Mario Fusco (Jira)
issues at jboss.org
Fri Apr 3 08:58:23 EDT 2020
[ https://issues.redhat.com/browse/DROOLS-5214?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14020305#comment-14020305 ]
Mario Fusco commented on DROOLS-5214:
-------------------------------------
I reproduced the problem thanks a lot. As a side note I noticed that it happens only if you use the fully qualified name of the class on which you're calling the static method. As a temporary workaround (if necessary) you could import java.util.Arrays and use the simple name in the method invocation like in
{code}
import java.util.Arrays;
rule "Array asList"
when Pojo(Arrays.asList(1,5,2,3).containsAll(integerList))
then
end
{code}
> Executable model compilation fails with constraints containing static method calls
> ----------------------------------------------------------------------------------
>
> Key: DROOLS-5214
> URL: https://issues.redhat.com/browse/DROOLS-5214
> Project: Drools
> Issue Type: Bug
> Components: core engine
> Affects Versions: 7.35.0.Final
> Reporter: Matteo Casalino
> Assignee: Mario Fusco
> Priority: Major
> Attachments: static-methods-in-contraint.zip
>
>
> Executable model rule compilation fails on patterns containing Java static method calls as constraints
> Example of DRL that fails to compile:
> {noformat}
> rule "Array asList"
> when Pojo(java.util.Arrays.asList(1,5,2,3).containsAll(integerList))
> then
> end
> {noformat}
> or
> {noformat}
> rule "collections disjoint"
> when $p : Pojo($boundList : integerList) Pojo(id > $p.id, !java.util.Collections.disjoint( integerList , $boundList ))
> then
> end
> {noformat}
> or
> {noformat}
> rule "containsAll"
> when Pojo(integerList.containsAll(java.util.Arrays.asList(1,3)), integerList.size() == 2)
> then
> end
> {noformat}
> All above examples work fine when compiling without executable model.
--
This message was sent by Atlassian Jira
(v7.13.8#713008)
More information about the jboss-jira
mailing list