Skip to content

Commit 7e1393c

Browse files
authored
Remove potential CCE in PatternMatchingForInstanceofFixCore (eclipse-jdt#2212)
- for eclipse-jdt#2208
1 parent c8117ed commit 7e1393c

File tree

1 file changed

+2
-6
lines changed

1 file changed

+2
-6
lines changed

org.eclipse.jdt.core.manipulation/core extension/org/eclipse/jdt/internal/corext/fix/PatternMatchingForInstanceofFixCore.java

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -114,9 +114,6 @@ public boolean visit(final InstanceofExpression visited) {
114114
boolean isPositiveCaseToAnalyze= true;
115115
ASTNode currentNode= visited;
116116

117-
if (visited.getLocationInParent() == ConditionalExpression.EXPRESSION_PROPERTY) {
118-
119-
}
120117
while (currentNode.getParent() != null
121118
&& (!(currentNode.getParent() instanceof IfStatement)
122119
|| currentNode.getLocationInParent() != IfStatement.EXPRESSION_PROPERTY)
@@ -173,9 +170,7 @@ public boolean visit(final InstanceofExpression visited) {
173170
fResult.add(collector.build());
174171
return false;
175172
}
176-
} else {
177-
IfStatement ifStatement= (IfStatement) currentNode.getParent();
178-
173+
} else if (currentNode.getParent() instanceof IfStatement ifStatement) {
179174
ResultCollector collector= new ResultCollector(visited);
180175
if (isPositiveCaseToAnalyze) {
181176
collector.collect(ifStatement.getThenStatement());
@@ -457,6 +452,7 @@ public PatternMatchingForInstanceofFixOperation(final InstanceofExpression nodeT
457452
this.expressionToMove= expressionToMove;
458453
}
459454

455+
@SuppressWarnings("deprecation")
460456
@Override
461457
public void rewriteAST(final CompilationUnitRewrite cuRewrite, final LinkedProposalModelCore linkedModel) throws CoreException {
462458
ASTRewrite rewrite= cuRewrite.getASTRewrite();

0 commit comments

Comments
 (0)