Drools MVEL eval() gotcha

We’ve got a Drools rule that contains this line in the consequence:
eval(!StringUtils.containsAny((String)$rv, “neg”) )
Uh uh. Can’t use the bang (!) to test for negation in the eval() statement. Won’t compile. Instead, we have to do this:
eval(StringUtils.containsAny((String)$rv, “neg”) == false)

This seems weird, because the eval() *should* be able to take any valid java syntax…


About buffalobillion

Web Developer, JavaScript Balrog, Java dude, Ruby/Rails enthusiast. Guitar Playa.
This entry was posted in Programming. Bookmark the permalink.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s