davsclaus commented on PR #26824:
URL: https://github.com/apache/camel/pull/26824#issuecomment-5809504038
Thanks for the regen @gnodet — merged, and the catalog doc now comes from
the updated source (verified byte-identical to
`core/camel-core-languages/src/main/docs/.../simple-operators.adoc`).
Three things since, all found by trying the edges rather than the happy path:
**A silent wrong answer.** `!${body} == 'x'` answered `true` whichever body
it was given — neither of the two things it could mean:
```
body='y': ${body} == 'x' -> false !${body} == 'x' -> true
body='x': ${body} == 'x' -> true !${body} == 'x' -> true
```
A comparison now refuses a negated function: `! cannot be compared: it
negates a function, so negate the operator instead`.
**The negation was stricter than the language.** `!${header.missing}` threw,
while `${header.missing}` as a predicate on its own is simply `false`. It now
uses the same rule (`ObjectHelper.evaluateValuePredicate`), so
`!${header.missing}` is `true`, `!${body}` is `false`, and `!${body.isEmpty()}`
is `true`.
**It was missing from the catalog**, which is what tooling reads.
`SimpleOperatorConstants` carries it now, and the regen reaches the language
json (37 operators), the catalog json, the docs copy, and
`camel-simple-validator.js`.
The documentation gains the rule, a table of what it answers, and the cases
that do **not** work: a space after the `!`, negating a comparison, a negation
on the right of one, and double negation outside the braces.
Also folded in here: the hint from CAMEL-24983 (#26822), reworded. That PR
said "! does not negate a function", which this makes false; where it still
fires (`${a} && !x`) the message now points at the form that works — `!x is
written as !${x}`. I would close #26822 rather than merge a hint that
contradicts this.
Full camel-core suite at the final state: **7503 tests, 0 failures.**
`SimpleNotOperatorTest` is 10 tests.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]