Why is “assert false” not causing AssertionError when assertion are activated programmatically?
问题 If I activate assertions following the Oracle documentation ClassLoader.getSystemClassLoader().setDefaultAssertionStatus(true); ClassLoader.getSystemClassLoader().setPackageAssertionStatus("richtercloud.java.assertion.ignored", true); System.out.println(String.format("desired assertion status: %b", NewMain.class.desiredAssertionStatus())); assert false; System.out.println("assertion has been ignored"); in the main method of a class richtercloud.java.assertion.ignored.NewMain , I see from the