Back to Intellij Community

AssertionCanBeIf

java/java-impl/resources/inspectionDescriptions/AssertionCanBeIf.html

2025.3-rc-2245 B
Original Source

Reports assert statements and suggests replacing them with if statements that throw java.lang.AssertionError.

Example:

assert param != null;

After the quick-fix is applied:

if (param == null) throw new AssertionError();