Inspectopedia Help

'assert' statement with side effects

Reports assert statements that cause side effects.

Since assertions can be switched off, these side effects are not guaranteed, which can cause subtle bugs. Common unwanted side effects detected by this inspection are modifications of variables and fields. When methods calls are involved, they are analyzed one level deep.

Example:

assert i++ < 10;

Inspection Details

Available in:

IntelliJ IDEA 2023.3, Qodana for JVM 2023.3

Plugin:

Java, 233.SNAPSHOT

Last modified: 13 July 2023