protected InterpreterBase()

in src/main/java/org/apache/commons/jexl3/internal/InterpreterBase.java [326:362]


    protected InterpreterBase(final Engine engine, final JexlOptions opts, final JexlContext aContext) {
        this.jexl = engine;
        this.logger = jexl.logger;
        this.uberspect = jexl.uberspect;
        this.context = aContext != null ? aContext : JexlEngine.EMPTY_CONTEXT;
        this.cache = engine.cache != null;
        final JexlArithmetic jexla = jexl.arithmetic;
        this.options = opts == null ? engine.evalOptions(aContext) : opts;
        this.arithmetic = jexla.options(options);
        if (arithmetic != jexla && !arithmetic.getClass().equals(jexla.getClass()) && logger.isWarnEnabled()) {
            logger.warn("expected arithmetic to be " + jexla.getClass().getSimpleName()
                    + ", got " + arithmetic.getClass().getSimpleName()
            );
        }
        if (this.context instanceof JexlContext.NamespaceResolver) {
            ns = (JexlContext.NamespaceResolver) context;
        } else {
            ns = JexlEngine.EMPTY_NS;
        }
        AtomicBoolean acancel = null;
        if (this.context instanceof JexlContext.CancellationHandle) {
            acancel = ((JexlContext.CancellationHandle) context).getCancellation();
        }
        this.cancelled = acancel != null ? acancel : new AtomicBoolean();
        this.functions = options.getNamespaces();
        this.functors = null;
        JexlOperator.Uberspect ops = uberspect.getOperator(arithmetic);
        if (ops == null) {
            ops = new Operator(uberspect, arithmetic);
        }
        this.operators = ops;
        // the import package facility
        final Collection<String> imports = options.getImports();
        this.fqcnSolver = imports.isEmpty()
                ? engine.classNameSolver
                : new FqcnResolver(engine.classNameSolver).importPackages(imports);
    }