可能是什么原因
assert(false); //this should fail but doesn't
//this gets executed but shouldn't
if(!false) throw new IllegalStateException("what's the bloody point?!!");
抛出IllegalStateException
而不是AssertionError
?
是的,我在代码中就有这两行。
答案 0 :(得分:3)
默认情况下,在运行时禁用断言,您需要提供-ea或-enableassertions JVM标志
答案 1 :(得分:1)