Inspectopedia Help

Infinite loop statement

Reports for, while, or do statements that can only exit by throwing an exception. While such statements may be correct, they often happen due to coding errors.

Example:

for (;;) { }

Use the Ignore when placed in Thread.run option to ignore the infinite loop statements inside Thread.run. It may be useful for the daemon threads.

Example:

new Thread(() -> { while (true) { } }).start();

Inspection options

Option

Type

Default

Ignore when placed in Thread.run

Checkbox

true

Inspection Details

Available in:

IntelliJ IDEA 2023.3, Qodana for JVM 2023.3

Plugin:

Java, 233.SNAPSHOT

Last modified: 13 July 2023