2016-06-07 80 views
0

sender ! truescalastyle抱怨的布爾

sender ! false

阿卡發送正在生成 「布爾表達式可以簡化」 由scalastyle警告。

如何讓這些警告消失?

回答

1

您可以在使用! true! false的行上禁用SimplifyBooleanExpression checker

sender ! true // scalastyle:ignore simplify.boolean.expression 

還是多行:

// scalastyle:off simplify.boolean.expression 
sender ! false 
// scalastyle:on simplify.boolean.expression 
+0

但爲什麼scalastyle呼喚這個代碼? – zzztimbo

+1

你是什麼意思? SimplifyBooleanExpressionChecker將位於* scalastyle-config.xml文件中。 Scalastyle看到'! true',並認爲它可以被'false'取代,但在這種情況下,它不夠聰明,因爲它是akka'!'操作符。 –