Inspectopedia Help

Constant conditional expression

Reports conditional expressions in which the condition is either a true or false constant. These expressions sometimes occur as a result of automatic refactorings and may be simplified.


return true ? "Yes" : "No";

After quick-fix is applied:

return "Yes";

Inspection Details

By default bundled with:

IntelliJ IDEA 2024.1, Qodana for JVM 2024.1,

Can be installed with plugin:

Java, 241.16690

Last modified: 29 April 2024