killme2008 / killme2008/aviatorscript
短路问题:user != nil && user.id > book.id && (nil + 1 > 3)
- Dominant language
- Java
- Stars
- 5.2k
- Forks
- 906
- PR merge metrics
- No merged PRs in 30d
Description
```java
public static void main(String[] args) {
boolean result = (boolean) AviatorEvaluator.execute("user != nil && user.id > book.id && (nil + 1 > 3)");
System.out.println(result);
}
```
希望短路并返回false,但是抛了异常:
```
Exception in thread "main" com.googlecode.aviator.exception.ExpressionRuntimeException: Could not add with
at com.googlecode.aviator.runtime.type.AviatorObject.add(AviatorObject.java:153)
at com.googlecode.aviator.runtime.type.AviatorNil.add(AviatorNil.java:51)
at com.googlecode.aviator.lexer.token.OperatorType.eval(OperatorType.java:108)
at com.googlecode.aviator.runtime.op.OperationRuntime.eval0(OperationRuntime.java:57)
at com.googlecode.aviator.runtime.op.OperationRuntime.eval(OperationRuntime.java:47)
at com.googlecode.aviator.code.OptimizeCodeGenerator.executeOperator(OptimizeCodeGenerator.java:221)
at com.googlecode.aviator.code.OptimizeCodeGenerator.execute(OptimizeCodeGenerator.java:158)
at com.googlecode.aviator.code.OptimizeCodeGenerator.getResult(OptimizeCodeGenerator.java:361)
```
Contributor guide
No contributing guide indexed for this repository
Research direction
Start by running the expression through AviatorEvaluator.execute and follow the stack from OperatorType.java and OperationRuntime.java into OptimizeCodeGenerator.java. Check how the && expression is evaluated when user is nil. Done means the supplied example returns false without evaluating the invalid nil addition or throwing an exception.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- java
- Domain
- compilers
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Quiet
- Clarity
- Mostly clear
- Newbie friendliness
- 52/100