garydgregory commented on code in PR #402:
URL: https://github.com/apache/commons-jexl/pull/402#discussion_r3311186918
##########
src/main/java/org/apache/commons/jexl3/JexlArithmetic.java:
##########
@@ -1005,6 +1007,37 @@ protected Object increment(final Object val, final int
incr) {
throw new ArithmeticException("Object "+(incr < 0?
"decrement":"increment")+":(" + val + ")");
}
+ /**
+ * Evaluates a supplier argument, eventually catching and logging any
JexlException.
+ *
+ * <p>Used primarily by {@link #empty(Object)} and {@link #size(Object)}
to guard argument evaluation.
+ * If evaluation succeeds, returns the supplier's result. If a {@link
JexlException} occurs, logs a
+ * warning and returns the supplier itself.</p>
+ *
+ * <p>This method is public to allow overriding. Implementations that
change the exception handling
+ * behavior must still return the supplier on failure to maintain the
contract.</p>
+ *
+ * @param logger the logger for warning messages; may be null
+ * @param arg the supplier providing the argument to evaluate
+ * @return the evaluated result on success, or the supplier itself on
JexlException
+ * @since 3.6.3
+ */
+ public Object evaluate(Log logger, Supplier<Object> arg) {
Review Comment:
Use `final`.
--
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]