抛出异常:
Exception in thread "main" com.googlecode.aviator.exception.ExpressionRuntimeException: Execute expression error
at com.googlecode.aviator.ClassExpression.execute(ClassExpression.java:79)
at com.googlecode.aviator.AviatorEvaluatorInstance.execute(AviatorEvaluatorInstance.java:686)
at com.googlecode.aviator.AviatorEvaluator.execute(AviatorEvaluator.java:428)
at com.googlecode.aviator.AviatorEvaluator.execute(AviatorEvaluator.java:440)
at com.googlecode.aviator.AviatorEvaluator.execute(AviatorEvaluator.java:461)
at Test.main(Test.java:7)
Caused by: java.lang.ClassCastException: Could not cast com.googlecode.aviator.runtime.type.AviatorDecimal@6f75e721 to long
at com.googlecode.aviator.runtime.function.system.LongFunction.call(LongFunction.java:41)
at Script_1542591851733_0/305623748.execute0(Unknown Source)
at com.googlecode.aviator.ClassExpression.execute(ClassExpression.java:71)
... 5 more
版本:4.0.0RC 代码: AviatorEvaluator.setOption(Options.ALWAYS_PARSE_FLOATING_POINT_NUMBER_INTO_DECIMAL, true); System.out.println(AviatorEvaluator.execute("long(1.2)"));
抛出异常: Exception in thread "main" com.googlecode.aviator.exception.ExpressionRuntimeException: Execute expression error at com.googlecode.aviator.ClassExpression.execute(ClassExpression.java:79) at com.googlecode.aviator.AviatorEvaluatorInstance.execute(AviatorEvaluatorInstance.java:686) at com.googlecode.aviator.AviatorEvaluator.execute(AviatorEvaluator.java:428) at com.googlecode.aviator.AviatorEvaluator.execute(AviatorEvaluator.java:440) at com.googlecode.aviator.AviatorEvaluator.execute(AviatorEvaluator.java:461) at Test.main(Test.java:7) Caused by: java.lang.ClassCastException: Could not cast com.googlecode.aviator.runtime.type.AviatorDecimal@6f75e721 to long at com.googlecode.aviator.runtime.function.system.LongFunction.call(LongFunction.java:41) at Script_1542591851733_0/305623748.execute0(Unknown Source) at com.googlecode.aviator.ClassExpression.execute(ClassExpression.java:71) ... 5 more