This is an automated email from the ASF dual-hosted git repository. henrib pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/commons-jexl.git
The following commit(s) were added to refs/heads/master by this push: new 95cc01a JEXL-307: ensure lexical interpretation on lexical feature Task #JEXL-307 - Variable redeclaration option 95cc01a is described below commit 95cc01a1528af6a6f7ce10f9a77ab39d92068537 Author: henrib <hen...@apache.org> AuthorDate: Thu Nov 14 14:35:58 2019 +0100 JEXL-307: ensure lexical interpretation on lexical feature Task #JEXL-307 - Variable redeclaration option --- .../org/apache/commons/jexl3/internal/Engine.java | 5 +--- .../org/apache/commons/jexl3/internal/Script.java | 27 +++++----------------- 2 files changed, 7 insertions(+), 25 deletions(-) diff --git a/src/main/java/org/apache/commons/jexl3/internal/Engine.java b/src/main/java/org/apache/commons/jexl3/internal/Engine.java index 4895578..e068eb1 100644 --- a/src/main/java/org/apache/commons/jexl3/internal/Engine.java +++ b/src/main/java/org/apache/commons/jexl3/internal/Engine.java @@ -421,10 +421,7 @@ public class Engine extends JexlEngine { Scope scope = names == null ? null : new Scope(null, names); JexlFeatures ftrs = features == null? scriptFeatures : features; ASTJexlScript tree = parse(info, ftrs, source, scope); - // when parsing lexical, try hard to run lexical - return ftrs.isLexical() - ? new Script.Lexical(this, source, tree) - : new Script(this, source, tree); + return new Script(this, source, tree); } /** diff --git a/src/main/java/org/apache/commons/jexl3/internal/Script.java b/src/main/java/org/apache/commons/jexl3/internal/Script.java index 593ad08..4aa692e 100644 --- a/src/main/java/org/apache/commons/jexl3/internal/Script.java +++ b/src/main/java/org/apache/commons/jexl3/internal/Script.java @@ -27,6 +27,7 @@ import org.apache.commons.jexl3.parser.ASTJexlScript; import java.util.List; import java.util.Map; import java.util.Set; +import org.apache.commons.jexl3.JexlFeatures; /** * <p>A JexlScript implementation.</p> @@ -106,29 +107,13 @@ public class Script implements JexlScript, JexlExpression { * @return the options */ protected JexlOptions createOptions(JexlContext context) { - return jexl.createOptions(this, context); - } - - /** - * A lexical script, ensures options are lexical. - */ - public static class Lexical extends Script { - /** - * Sole ctor. - * @param engine the engine - * @param expr the source. - * @param ref the ast - */ - protected Lexical(Engine engine, String expr, ASTJexlScript ref) { - super(engine, expr, ref); - } - - @Override - public JexlOptions createOptions(JexlContext ctxt) { - JexlOptions opts = super.createOptions(ctxt); + JexlOptions opts = jexl.createOptions(this, context); + // when parsing lexical, try hard to run lexical + JexlFeatures features = script.getFeatures(); + if (features != null && features.isLexical()) { opts.setLexical(true); - return opts; } + return opts; } /**