EA-70172 (CCE: EqualityToEqualsFix.doFix)

This commit is contained in:
Bas Leijdekkers
2015-07-01 22:40:12 +02:00
parent a6e21812c0
commit a99d360907
@@ -1,5 +1,5 @@
/*
* Copyright 2003-2014 Dave Griffith, Bas Leijdekkers
* Copyright 2003-2015 Dave Griffith, Bas Leijdekkers
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -48,11 +48,11 @@ public class EqualityToEqualsFix extends InspectionGadgetsFix {
@Override
public void doFix(Project project, ProblemDescriptor descriptor) {
final PsiElement comparisonToken = descriptor.getPsiElement();
final PsiBinaryExpression expression = (PsiBinaryExpression)
comparisonToken.getParent();
if (expression == null) {
final PsiElement parent = comparisonToken.getParent();
if (!(parent instanceof PsiBinaryExpression)) {
return;
}
final PsiBinaryExpression expression = (PsiBinaryExpression)parent;
boolean negated = false;
final IElementType tokenType = expression.getOperationTokenType();
if (JavaTokenType.NE.equals(tokenType)) {