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

Available in:

IntelliJ IDEA 2023.3, Qodana for JVM 2023.3


Java, 233.SNAPSHOT

Last modified: 13 July 2023