[ https://issues.apache.org/jira/browse/JEXL-307?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16984222#comment-16984222 ]
Dmitri Blinov edited comment on JEXL-307 at 11/28/19 11:40 AM: --------------------------------------------------------------- I've got a regression with recent changes. For some reason the script created with JexlInfo fails to report declared parameters and local variables. The following test case illustrates this {code:java} @Test public void testParameters() throws Exception { String str = "function(u) {}"; JexlEngine jexl = new JexlBuilder().create(); JexlScript e = jexl.createScript(new JexlInfo("TestScript", 1, 1), str); Assert.assertEquals(1, e.getParameters().length); } {code} While the following test case passes correctly: {code:java} @Test public void testParameters() throws Exception { String str = "function(u) {}"; JexlEngine jexl = new JexlBuilder().create(); JexlScript e = jexl.createScript(str); Assert.assertEquals(1, e.getParameters().length); } {code} was (Author: dmitri_blinov): I've got a regression with recent changes. For some reason the script created with JexlInfo fails to report declared parameters and local variables. The following test case illustrates this {code:java} @Test public void testParameters() throws Exception { String str = "function(u) {}"; JexlEngine jexl = new JexlBuilder().create(); JexlScript e = jexl.createScript(new JexlInfo("TestScript", 1, 1), str); Assert.assertEquals(1, e.getParameters().length); } {code} > Variable redeclaration option > ----------------------------- > > Key: JEXL-307 > URL: https://issues.apache.org/jira/browse/JEXL-307 > Project: Commons JEXL > Issue Type: New Feature > Affects Versions: 3.1 > Reporter: Dmitri Blinov > Assignee: Henri Biestro > Priority: Minor > Fix For: 3.2 > > > As of now, JEXL allows a script writer to redeclare a local variable during > script evaluation. > {code:java} > var a = 1; var a = 2;{code} > This may lead to potential errors with misspelled names and clashed > variables. Checking for already defined variable is a common feature of many > languages. This feature can be implemented in JEXL as an additional option of > JexlFeatures class, enabled by default, thus allowing compatibility with > existing code. -- This message was sent by Atlassian Jira (v8.3.4#803005)