Hello. I'm trying to fix these tickets as I ran into them the other day. -2894 looks relatively straightforward, and I have a working fix in https://github.com/veselov/openjpa/tree/OPENJPA-2894.
However, I ran into -2895 as I was trying to test -2894, and fixing that looks a lot more complicated. Just to get -2894 to test, I've changed the TRUE/FALSE predicate definitions from using equality and non-equality expressions to using just constant true/false expressions. This blew out TestTypesafeCriteria true/false tests, though the problem is just in comparing the JPQL/CQL query text, otherwise those queries are correct. So, a question: is there a (non-obvious) reason why TRUE/FALSE Predicates should be defined as equality/non-equality, and can't be just TRUE/FALSE boolean expressions? Once -2895 is fixed, it won't be a problem, but still seeing (1==1) or (1<>1) instead of TRUE/FALSE (which also optimizes out in some cases) looks more clunky to me. For fixing -2895, the only solution that I could find is to properly implement toValue() for the predicates. For predicates simply wrapping an expression, it's trivial - just return toValue() of the expressions. But for real predicates (i.e., AND/OR/NOT operators), I would need to build a new Value class that represents them. However, I'm quite overwhelmed by the requirements of the Value class. I've tried modeling things after "Math" (similar syntax, binary operators) and "GeneralCaseExpression" (similar structure, since predicates can have more than two arguments), but I just don't understand the intention of the ExpState related methods, especially "calculateValue()" (what is this "other" value, and what's up with reciprocity on nested values that, say, Math does), and "length" (why does Math or GeneralCaseExpression return length of 1, what is the definition of "element" that the corresponding JavaDoc is talking about) So, two questions here: - is there a better way for creating predicate values? Or any better approach to solving -2895? - if not, can somebody offer insights on the Value methods contracts? Thank you! Pawel.