JMeter - jexl3 函数不能声明局部变量

JMeter - jexl3 function can't declare local variables

我正在使用最新的 JMeter 4 并尝试使用基本的 jexl syntax of declaring local variable in jexl function

Local variables Can be defined using the var keyword; their identifying rules are the same as contextual variables. Basic declaration: var x;

所以在 JMeter 中我尝试了

${__jexl2(var x;)}

并成功,但使用 ${__jexl3(var x;)} 它抛出解析器异常:

2018-04-25 14:18:16,451 ERROR o.a.j.f.Jexl3Function: An error occurred while evaluating the expression "var a;"

org.apache.commons.jexl3.JexlException$Parsing: @1:1 parsing error in 'var'
    at org.apache.commons.jexl3.JexlEngine.createExpression(JexlEngine.java:304) ~[commons-jexl3-3.1.jar:3.1]
    at org.apache.jmeter.functions.Jexl3Function.execute(Jexl3Function.java:94) [ApacheJMeter_functions.jar:4.0 r1823414]
    at org.apache.jmeter.engine.util.CompoundVariable.execute(CompoundVariable.java:137) [ApacheJMeter_core.jar:4.0 r1823414]
    at org.apache.jmeter.engine.util.CompoundVariable.execute(CompoundVariable.java:112) [ApacheJMeter_core.jar:4.0 r1823414]
    at org.apache.jmeter.testelement.property.FunctionProperty.getStringValue(FunctionProperty.java:101) [ApacheJMeter_core.jar:4.0 r1823414]
    at org.apache.jmeter.testelement.AbstractTestElement.getPropertyAsString(AbstractTestElement.java:281) [ApacheJMeter_core.jar:4.0 r1823414]
    at org.apache.jmeter.testelement.AbstractTestElement.getName(AbstractTestElement.java:165) [ApacheJMeter_core.jar:4.0 r1823414]
    at org.apache.jmeter.sampler.DebugSampler.sample(DebugSampler.java:56) [ApacheJMeter_components.jar:4.0 r1823414]
    at org.apache.jmeter.threads.JMeterThread.executeSamplePackage(JMeterThread.java:490) [ApacheJMeter_core.jar:4.0 r1823414]
    at org.apache.jmeter.threads.JMeterThread.processSampler(JMeterThread.java:416) [ApacheJMeter_core.jar:4.0 r1823414]
    at org.apache.jmeter.threads.JMeterThread.run(JMeterThread.java:250) [ApacheJMeter_core.jar:4.0 r1823414]
    at java.lang.Thread.run(Unknown Source) [?:1.8.0_25]

是 JMeter 问题还是 jexl3 问题,还是我遗漏了什么?

编辑

除了无法解析 var 之外,它还无法解析 ;,这是一个使用 jexl2 的工作示例,但使用 jexl3 失败:

${__jexl3(abc=new("java.util.ArrayList"\, 1);)}

这是一个 bug in JMeter Jexl3 implementation according to jexl issue:

JMeter using JexlExpression instead of JexlScript

错误已修复,下个版本会上传