protected Object tryOverload()

in src/main/java/org/apache/commons/jexl3/internal/Operators.java [124:154]


    protected Object tryOverload(final JexlNode node, final JexlOperator operator, final Object... args) {
        final JexlArithmetic arithmetic = interpreter.arithmetic;
        controlNullOperands(arithmetic, operator, args);
        if (operators != null && operators.overloads(operator)) {
            final boolean cache = interpreter.cache;
            try {
                if (cache) {
                    final Object cached = node.jjtGetValue();
                    if (cached instanceof JexlMethod) {
                        final JexlMethod me = (JexlMethod) cached;
                        final Object eval = me.tryInvoke(operator.getMethodName(), arithmetic, args);
                        if (!me.tryFailed(eval)) {
                            return eval;
                        }
                    }
                }
                final JexlMethod vm = operators.getOperator(operator, args);
                if (vm != null && !isArithmetic(vm)) {
                    final Object result = vm.invoke(arithmetic, args);
                    if (cache && !vm.tryFailed(result)) {
                        node.jjtSetValue(vm);
                    }
                    return result;
                }
            } catch (final Exception xany) {
                // ignore return if lenient, will return try_failed
                interpreter.operatorError(node, operator, xany);
            }
        }
        return JexlEngine.TRY_FAILED;
    }