killme2008 / killme2008/aviatorscript
aviator 短路模式在调试模式下失效
- Dominant language
- Java
- Stars
- 5.2k
- Forks
- 906
- PR merge metrics
- No merged PRs in 30d
Description
`@Test
public void testReject() {
String av = "let aa=nil;return aa !=nil && string.length(aa) > 0;";
Object obj = riskAviatorEvaluator.execute(av, new Context());
System.out.println("-------------" + GsonUtilWithToNumberPolicy.obj2jsonStr(obj));
System.out.println(RiskAviatorTraceEvaluator.newInstance().execute(av, new Context()));
}`
上面是执行的一段代码,输出结果如下:
可见在非调试模式下,执行结果false符合预期,但是在调试模式下会报空指针异常,看起来短路模式失效了,执行了string.length(aa)这个语句。想问一下是特地这样设计的么?原因是什么
Contributor guide
No contributing guide indexed for this repository
Research direction
Start with the testReject reproducer and compare riskAviatorEvaluator.execute(av, new Context()) with RiskAviatorTraceEvaluator.newInstance().execute(av, new Context()). Trace the debug evaluator's handling of the && expression and string.length(aa). Done means the debug path matches the non-debug short-circuit result without the null-pointer exception, with a regression test for this expression.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- java
- Domain
- devtools
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100