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
commit bec932824e975e3488681ebd2fc844a31e23a0da Author: Henrib <hbies...@gmail.com> AuthorDate: Wed Dec 11 19:36:46 2024 +0100 JEXL: scripting nitpicks; --- src/main/java/org/apache/commons/jexl3/parser/Parser.jjt | 6 +++--- src/test/java/org/apache/commons/jexl3/ClassCreatorTest.java | 6 +++--- .../apache/commons/jexl3/scripting/JexlScriptEngineTest.java | 12 ++++++------ 3 files changed, 12 insertions(+), 12 deletions(-) diff --git a/src/main/java/org/apache/commons/jexl3/parser/Parser.jjt b/src/main/java/org/apache/commons/jexl3/parser/Parser.jjt index 9b1d5c25..c926e40d 100644 --- a/src/main/java/org/apache/commons/jexl3/parser/Parser.jjt +++ b/src/main/java/org/apache/commons/jexl3/parser/Parser.jjt @@ -715,9 +715,9 @@ void EqualityExpression() #void : {} | (<ne> | <NE>) RelationalExpression() #NENode(2) | - (<eqstrict>) RelationalExpression() #EQSNode(2) + <eqstrict> RelationalExpression() #EQSNode(2) | - (<neqstrict>) RelationalExpression() #NESNode(2) + <neqstrict> RelationalExpression() #NESNode(2) | <range> RelationalExpression() #RangeNode(2) // range ) )? @@ -1098,7 +1098,7 @@ void ArrayAccess() : { int s = 0; } { - (LOOKAHEAD(2) (<LBRACKET>|<QLBRACKET> { safe |= (1 << s++); }) Expression() <RBRACKET>)+ { jjtThis.setSafe(safe); } + (LOOKAHEAD(2) (<LBRACKET>|<QLBRACKET> { safe |= (1L << s++); }) Expression() <RBRACKET>)+ { jjtThis.setSafe(safe); } } void MemberAccess() #void : {} diff --git a/src/test/java/org/apache/commons/jexl3/ClassCreatorTest.java b/src/test/java/org/apache/commons/jexl3/ClassCreatorTest.java index c689ab3c..913159cf 100644 --- a/src/test/java/org/apache/commons/jexl3/ClassCreatorTest.java +++ b/src/test/java/org/apache/commons/jexl3/ClassCreatorTest.java @@ -192,12 +192,12 @@ public class ClassCreatorTest extends JexlTestCase { @AfterEach @Override - public void tearDown() throws Exception { + public void tearDown() { deleteDirectory(base); } @Test - void testBasicCtor() throws Exception { + void testBasicCtor() { final JexlScript s = jexl.createScript("(c, v)->{ var ct2 = new(c, v); ct2.value; }"); Object r = s.execute(null, TwoCtors.class, 10); assertEquals(10, r); @@ -210,7 +210,7 @@ public class ClassCreatorTest extends JexlTestCase { } @Test - void testContextualCtor() throws Exception { + void testContextualCtor() { final MapContext ctxt = new MapContext(); ctxt.set("value", 42); JexlScript s = jexl.createScript("(c)->{ new(c).value }"); diff --git a/src/test/java/org/apache/commons/jexl3/scripting/JexlScriptEngineTest.java b/src/test/java/org/apache/commons/jexl3/scripting/JexlScriptEngineTest.java index 1c680f59..94bc48f0 100644 --- a/src/test/java/org/apache/commons/jexl3/scripting/JexlScriptEngineTest.java +++ b/src/test/java/org/apache/commons/jexl3/scripting/JexlScriptEngineTest.java @@ -136,16 +136,16 @@ public class JexlScriptEngineTest { final JexlScriptEngine engine = (JexlScriptEngine) manager.getEngineByName("JEXL"); final ScriptContext ctxt = engine.getContext(); engine.put("errors", new Errors()); - assertTrue(assertThrows(ScriptException.class, () -> engine.eval("errors.npe()")).getCause() instanceof NullPointerException); - assertTrue(assertThrows(ScriptException.class, () -> engine.eval("errors.illegal()")).getCause() instanceof IllegalArgumentException); + assertInstanceOf(NullPointerException.class, assertThrows(ScriptException.class, () -> engine.eval("errors.npe()")).getCause()); + assertInstanceOf(IllegalArgumentException.class, assertThrows(ScriptException.class, () -> engine.eval("errors.illegal()")).getCause()); final CompiledScript script0 = engine.compile("errors.npe()"); - assertTrue(assertThrows(ScriptException.class, () -> script0.eval()).getCause() instanceof NullPointerException); + assertInstanceOf(NullPointerException.class, assertThrows(ScriptException.class, script0::eval).getCause()); final CompiledScript script1 = engine.compile("errors.illegal()"); - assertTrue(assertThrows(ScriptException.class, () -> script1.eval()).getCause() instanceof IllegalArgumentException); + assertInstanceOf(IllegalArgumentException.class, assertThrows(ScriptException.class, script1::eval).getCause()); } @Test - void testNulls() throws Exception { + void testNulls() { final ScriptEngineManager manager = new ScriptEngineManager(); assertNotNull(manager, "Manager should not be null"); final ScriptEngine engine = manager.getEngineByName("jexl3"); @@ -181,7 +181,7 @@ public class JexlScriptEngineTest { } @Test - void testScriptEngineFactory() throws Exception { + void testScriptEngineFactory() { final JexlScriptEngineFactory factory = new JexlScriptEngineFactory(); assertEquals("JEXL Engine", factory.getParameter(ScriptEngine.ENGINE)); assertEquals("3.4", factory.getParameter(ScriptEngine.ENGINE_VERSION));