aviatorInstance.addInstanceFunctions("fnc",Xxxx.class);
对于非静态方法:
pTypes: [Class<?> clazz, 原参数类型...] (长度 = n+1)
jArgs: 直接从所有 args 构建 (长度 = n)
结果: 参数数量不匹配,导致类型转换错误Cannot cast java.lang.String to xxxx.aviator.impl.Xxxx
我目前的处理方式是使用静态方法包了一层,
后面看你的测试类,发现在方法的使用上,要先把方法类对象作为第一个参数传入,这个有优化方案吗
TestUtils t = new TestUtils();
Map<String, Object> env = new HashMap<>();
env.put("t", t);
assertTrue((boolean) this.instance.execute("test.is_empty(t, '')", env));
assertFalse((boolean) this.instance.execute("test.is_empty(t, t)", env));