[rules-users] Trouble using java.util.List.size in constraints in 5.4.0.Final

Alexis Brouard alexis.brouard at haulogy.net
Thu Jun 14 10:07:27 EDT 2012


Hi everyone,

I've tried to go from Drools 5.3.0.Final to 5.4.0.Final and some strange
errors appeared on constraints using the size of a list.

For instance, given the following object:

public class MyObject {

private List<String> param = new ArrayList<String>();

 public MyObject() {
super();
}

public List<String> getParam() {
return param;
}

public void setParam(List<String> param) {
this.param = param;
 }
}


This rule:

rule "Sample rule"
    when
        MyObject( param.size > 0 )
    then
        System.out.println( "Sample rule activated" );
end


Provokes the following error:

Unable to Analyse Expression param.size > 0:
[Error: Comparison operation requires compatible types. Found class
java.lang.String and class java.lang.Integer]
[Near : {... param.size > 0 ....}]
                          ^ : [Rule name='Sample rule']


This worked very well in Drools 5.3.0.Final.
Is there some configuration specific to Drools 5.4.0.Final that I've missed
in the release notes?

Thanks in advance for your help.

Best,
Alexis
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/rules-users/attachments/20120614/2888d1ee/attachment.html 


More information about the rules-users mailing list