mirror of
https://github.com/JetBrains/intellij-sdk-code-samples.git
synced 2025-07-27 16:57:49 +08:00
[Code Samples Inspection] Java > Control flow issues > Redundant 'if' statement
This commit is contained in:
parent
56cefc5580
commit
e4a93ccf13
@ -70,11 +70,8 @@ public class ConditionalOperatorConverter extends PsiElementBaseIntentionAction
|
|||||||
// Is this token part of a fully formed conditional, i.e. a ternary?
|
// Is this token part of a fully formed conditional, i.e. a ternary?
|
||||||
if (token.getParent() instanceof PsiConditionalExpression) {
|
if (token.getParent() instanceof PsiConditionalExpression) {
|
||||||
final PsiConditionalExpression conditionalExpression = (PsiConditionalExpression) token.getParent();
|
final PsiConditionalExpression conditionalExpression = (PsiConditionalExpression) token.getParent();
|
||||||
if (conditionalExpression.getThenExpression() == null
|
return conditionalExpression.getThenExpression() != null
|
||||||
|| conditionalExpression.getElseExpression() == null) {
|
&& conditionalExpression.getElseExpression() != null;// Satisfies all criteria; call back invoke method
|
||||||
return false;
|
|
||||||
}
|
|
||||||
return true; // Satisfies all criteria; call back invoke method
|
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user