I am using Optaplanner 6.2Final version and everything is working fine except the matches operator. To explain more, this is my rule.
rule "TEST REG EXP OPERATOR"
when
$cheese:Cheese($cheese.type matches "(Buffulo)?\\S*Mozarella")
then
scoreHolder.addSoftConstraintMatch(kcontext, 1);
end
The following is the exception thrown:
Exception in thread "main" [Error: unable to resolve method: com.app.test.domain.Cheese.$cheese() [arglength=0]]
[Near : {... $cheese.type ~= "(Buffulo)?\\S*Mozarella" ....}]
Note : if I removed $cheese. declaration in front of type, the rule has no issue. This is working fine :
$cheese:Cheese($cheese.type == "Buffulo")
Any suggestions would be appreciated.
UPDATE: It turns out that the following throws exception ONLY on the drools core version 6.2.0.Final and 6.3.0.Final after I have done checking on all the version. It is working in the rest of versions.
$cheese:Cheese($cheese.type matches "(Buffulo)?\\S*Mozarella")