Intellij IDEA 是否检查了由于忘记了 break
而在 switch
语句中可能无意中掉线?
最佳答案
是的,确实如此:
Reports 'fall-through' in a switch statement. Fall-through is defined to occur when a series of executable statements after a switch label is not guaranteed to transfer control before the next switch label. In that case, control falls through to the statements after that switch label, even though the switch expression does not equal the value of the fallen-through label. While occasionally intended, this construction is confusing, and is often the result of a typo.
请注意,此检查默认情况下处于禁用状态,因此如果您想使用它,请勾选右侧的复选框。
关于java - Intellij 检查 switch case fall-through,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/43395722/