Inspectopedia Help

Throwable supplier never returns a value

Reports Supplier lambdas in Optional.orElseThrow() calls that throw an exception, instead of returning it.


optional.orElseThrow(() -> { throw new RuntimeException(); });

After the quick-fix is applied:

optional.orElseThrow(() -> new RuntimeException());

New in 2023.1

Inspection Details

Available in:

IntelliJ IDEA 2023.3, Qodana for JVM 2023.3


Java, 233.SNAPSHOT

Last modified: 13 July 2023