[
https://issues.apache.org/jira/browse/JEXL-179?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14720547#comment-14720547
]
Henri Biestro commented on JEXL-179:
------------------------------------
There is something else causing the problem.
Besides test147b/test147c in Issues, the following code works:
{code}
@Test
public void test179() throws Exception {
JexlContext jc = new MapContext();
JexlEngine jexl = new JexlBuilder().create();
String src = "x = new ('java.util.HashSet'); x.add(1); x";
JexlScript e = jexl.createScript(src);
Object o = e.execute(jc);
Assert.assertTrue(o instanceof Set);
Assert.assertTrue(((Set) o).contains(1));
}
{code}
> new() operator is broken
> ------------------------
>
> Key: JEXL-179
> URL: https://issues.apache.org/jira/browse/JEXL-179
> Project: Commons JEXL
> Issue Type: Bug
> Affects Versions: 3.0
> Reporter: Dmitri Blinov
>
> As an example,
> {code}
> x = new ("java.util.HashSet"); x.add(1); x
> {code}
> The following script generates log output
> {code}
> [DEBUG] EvaluationContext.evaluateScript: expr: x = new
> ("java.util.HashSet"); x.add(1); x
> [WARN ] org.apache.commons.jexl3.JexlEngine:
> EvaluationContext.evaluateScript@493 java.util.HashSet
> [WARN ] org.apache.commons.jexl3.JexlEngine:
> EvaluationContext.evaluateScript@493![30,38]: 'x = new('java.util.HashSet');
> x.add(1);
> x;
> ' null value variable x
> {code}
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)