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 8543871 JEXL-307: as a default, copy options handled of context used at runtime to reduce the possibility of artificially complex mistakes; add an explicit flag to still allow purposeful usage Task #JEXL-307 - Variable redeclaration option Task #JEXL-307 - Variable redeclaration option 8543871 is described below commit 854387184da4044769669e84235d1ef4d7f8f43b Author: henrib <hen...@apache.org> AuthorDate: Mon Nov 18 17:41:14 2019 +0100 JEXL-307: as a default, copy options handled of context used at runtime to reduce the possibility of artificially complex mistakes; add an explicit flag to still allow purposeful usage Task #JEXL-307 - Variable redeclaration option Task #JEXL-307 - Variable redeclaration option --- src/main/java/org/apache/commons/jexl3/JexlOptions.java | 2 +- src/test/java/org/apache/commons/jexl3/LexicalTest.java | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/src/main/java/org/apache/commons/jexl3/JexlOptions.java b/src/main/java/org/apache/commons/jexl3/JexlOptions.java index 0682e4e..98c46ef 100644 --- a/src/main/java/org/apache/commons/jexl3/JexlOptions.java +++ b/src/main/java/org/apache/commons/jexl3/JexlOptions.java @@ -59,7 +59,7 @@ public final class JexlOptions { "cancellable", "strict", "silent", "safe", "lexical", "antish", "lexicalShade", "sharedInstance" }; /** Default mask .*/ - private static int DEFAULT = 1 /*<< CANCELLABLE*/ | 1 << STRICT | 1 << ANTISH | 1 << SAFE | 1 << SHARED; + private static int DEFAULT = 1 /*<< CANCELLABLE*/ | 1 << STRICT | 1 << ANTISH | 1 << SAFE; /** The arithmetic math context. */ private MathContext mathContext = null; /** The arithmetic math scale. */ diff --git a/src/test/java/org/apache/commons/jexl3/LexicalTest.java b/src/test/java/org/apache/commons/jexl3/LexicalTest.java index d950d3a..9f7b9c9 100644 --- a/src/test/java/org/apache/commons/jexl3/LexicalTest.java +++ b/src/test/java/org/apache/commons/jexl3/LexicalTest.java @@ -393,10 +393,11 @@ public class LexicalTest { JexlEngine jexl = new JexlBuilder().features(f).strict(true).create(); JexlEvalContext ctxt = new JexlEvalContext(); JexlOptions options = ctxt.getEngineOptions(); + options.setSharedInstance(false); options.setLexical(true); options.setLexicalShade(true); ctxt.set("options", options); - JexlScript script = jexl.createScript("{var x = 42;} options.lexical = false; x"); + JexlScript script = jexl.createScript("{var x = 42;} options.lexical = false; options.lexicalShade=false; x"); try { Object result = script.execute(ctxt); Assert.fail("setting options.lexical should have no effect during execution");