janino

Janino: Script won't compile (cook) if ! operator is used


I am having a problem compiling (cook) following Janino script.

(((sfv1.equals(a_p))))&&(((sfv2.equals(a_ac))))&&(((!(a_d~~bfv3))))  

I am passing parameter types for [sfv1, a_p, sfv2,a_ac, a_d~~bfv3], where a_d~~bfv3 is a Boolean type and rest are Strings.
I am seeing following error when I tried cook the script.

org.codehaus.commons.compiler.CompileException: Line 1, Column 0: ')' expected (compiler.err.expected)

I have tried changing the script to following, with the same result:

(((sfv1.equals(a_p))))&&(((sfv2.equals(a_ac))))&&(((!(a_d~~bfv3==true))))

I am wondering if Janino doesn't have support for Boolean type parameters. Can any one help me with this?


Solution

  • '~' is a pre-defined operator in Janino. This was the reason for the error. When '~' was found, Janino was expecting matching ')' for '('.

    Replacing "~~" with "__" resolved the issue for me.