流口水:{} 结果中的大括号和条件 - 大括号有所不同,它们在 Java 中没有

drools: {} braces and conditionals in consequences - braces make a difference they do not in Java

我想我一定是漏掉了一些关于 Drools 的东西。我有一个规则,结果是有条件的。例如:

rule "Action Close When Closed"
when
    $action: ActionClose( $id: actionId, $initiator: initiator, $thing: thing )
    $open: DroolsPositVertexProperty( vertex == $thing, key == K.N_OPEN, value == false )
then
    support.deferredOutcome( $initiator, $id, K.O_NOTHING );
    support.retractFact( $action );
    support.tickle( $thing );
    if (support.LOW_LEVEL_TRACE)
        System.out.printf("%s: thing already closed\n", drools.getRule().getName());
end

让我感到困惑的是,如果我有 if () {} 形式(带花括号),条件的行为与我怀疑的一样,但即使在没有 {} 大括号的情况下也不应该触发。我错过了文档中的某些内容吗?这是 7.40.0.Final。一切都说牙套会有所作为,但它们不应该。或者我错过了某处非常重要的东西。有什么指点吗?

为了支持 modify {}.

等自定义语句,结果中总会涉及一些重写

解析 Java 代码的边缘情况,例如“if without braces”实际上并不那么简单(特别是因为空格在某些情况下可能很重要,而在纯 Java 中则不然)。

长话短说,在结果中始终使用显式大括号。谢谢:)