* if (isWhatever() || true) -> if (true), unless side effects
* </pre>
*/
private void shortCircuitOr(JExpression lhs, JExpression rhs, Context ctx) {
if (lhs instanceof JBooleanLiteral) {
JBooleanLiteral booleanLiteral = (JBooleanLiteral) lhs;
if (booleanLiteral.getValue()) {
ctx.replaceMe(lhs);
} else {
ctx.replaceMe(rhs);
}
} else if (rhs instanceof JBooleanLiteral) {
JBooleanLiteral booleanLiteral = (JBooleanLiteral) rhs;
if (!booleanLiteral.getValue()) {
ctx.replaceMe(lhs);
} else if (!lhs.hasSideEffects()) {
ctx.replaceMe(rhs);
}
}