in src/main/java/org/apache/commons/jexl3/internal/Operator.java [423:462]
public Object tryAssignOverload(final JexlCache.Reference node,
final JexlOperator operator,
final Consumer<Object> assignFun,
final Object... args) {
if (args.length < operator.getArity()) {
return JexlEngine.TRY_FAILED;
}
Object result = JexlEngine.TRY_FAILED;
try {
// if the operator is strict, the left-hand side can not be null
controlNullOperands(arithmetic, operator, args[0]);
// attempt assignment operator overload
if (overloads(operator)) {
result = tryOverload(node, operator, arguments(operator, args));
if (result != JexlEngine.TRY_FAILED) {
return result;
}
}
// let's attempt base operator overload
final JexlOperator base = operator.getBaseOperator();
if (base != null && overloads(base)) {
result = tryOverload(node, base, arguments(base, args));
}
// no overload or overload failed, use base operator
if (result == JexlEngine.TRY_FAILED) {
result = performBaseOperation(operator, args);
}
// on success, assign value
if (result != JexlEngine.TRY_FAILED) {
assignFun.accept(result);
// postfix implies return initial argument value
if (POSTFIX_OPS.contains(operator)) {
result = args[0];
}
}
return result;
} catch (final Exception any) {
return operatorError(node, operator, any, JexlEngine.TRY_FAILED);
}
}