在drools中使用匿名时,我发现你无法在其中定义成员变量
rule "abstract test"
agenda-group "abstract test"
when
eval(true)
then
new AbstractFoo(){
private final Object obj = new Object();
@Override
public void doSomething() {
synchronized (obj){
System.out.println("doSomethong");
}
}
}.doSomething();
end
编译drl时,会出现以下错误
2017-04-17 22:14:01.590 ERROR [main] [org.drools.compiler.kie.builder.impl.AbstractKieModule.java:250] - Unable to build KieBaseModel:kbase
Unable to determine the used declarations.
java.util.EmptyStackException : [Rule name='abstract test']
java.util.EmptyStackException
为什么会这样?