mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
Java: Changed defaults for the inspection "Replace with Objects.equals()" (IDEA-193783)
This commit is contained in:
+1
-1
@@ -42,7 +42,7 @@ import javax.swing.*;
|
||||
* @author Bas Leijdekkers
|
||||
*/
|
||||
public class EqualsReplaceableByObjectsCallInspection extends BaseInspection {
|
||||
public boolean checkNotNull;
|
||||
public boolean checkNotNull = true;
|
||||
|
||||
private static final EquivalenceChecker EQUIVALENCE = new NoSideEffectExpressionEquivalenceChecker();
|
||||
|
||||
|
||||
@@ -1288,7 +1288,7 @@
|
||||
implementationClass="com.siyeh.ig.migration.BigDecimalLegacyMethodInspection"/>
|
||||
<localInspection groupPath="Java,Java language level migration aids" language="JAVA" shortName="EqualsReplaceableByObjectsCall" bundle="com.siyeh.InspectionGadgetsBundle"
|
||||
key="equals.replaceable.by.objects.call.display.name" groupBundle="messages.InspectionsBundle"
|
||||
groupKey="group.names.language.level.specific.issues.and.migration.aids7" enabledByDefault="true" level="INFORMATION"
|
||||
groupKey="group.names.language.level.specific.issues.and.migration.aids7" enabledByDefault="true" level="WEAK WARNING"
|
||||
implementationClass="com.siyeh.ig.migration.EqualsReplaceableByObjectsCallInspection"/>
|
||||
<localInspection groupPath="Java" language="JAVA" shortName="EnumerationCanBeIteration" bundle="com.siyeh.InspectionGadgetsBundle"
|
||||
key="enumeration.can.be.iteration.display.name" groupBundle="messages.InspectionsBundle"
|
||||
|
||||
+16
-8
@@ -27,14 +27,16 @@ import com.siyeh.ig.migration.EqualsReplaceableByObjectsCallInspection;
|
||||
*/
|
||||
public class EqualsReplaceableByObjectsCallFixTest extends IGQuickFixesTestCase {
|
||||
|
||||
public void testSimpleEquals() { doTest(); }
|
||||
public void testSimpleNotEquals() { doTest(); }
|
||||
private EqualsReplaceableByObjectsCallInspection myInspection;
|
||||
|
||||
public void testQualifiedArgument() { doTest(); }
|
||||
public void testSimpleEquals() { doTestNoNullCheck(); }
|
||||
public void testSimpleNotEquals() { doTestNoNullCheck(); }
|
||||
|
||||
public void testQualifiedArgument() { doTestNoNullCheck(); }
|
||||
public void testQualifiedReciever() { doTest(); }
|
||||
|
||||
public void testExpressionReciever() { doTest(); }
|
||||
public void testExpressionArgument() { doTest(); }
|
||||
public void testExpressionReciever() { doTestNoNullCheck(); }
|
||||
public void testExpressionArgument() { doTestNoNullCheck(); }
|
||||
public void testExpressionArgument2() { doTest(); }
|
||||
|
||||
public void testLongEquals() { doTest(); }
|
||||
@@ -42,8 +44,8 @@ public class EqualsReplaceableByObjectsCallFixTest extends IGQuickFixesTestCase
|
||||
public void testShortEquals() { doTest(); }
|
||||
public void testShortNotEquals() { doTest(); }
|
||||
|
||||
public void testSuperEquals() { doTest(); }
|
||||
public void testThisEquals() { doTest(); }
|
||||
public void testSuperEquals() { doTestNoNullCheck(); }
|
||||
public void testThisEquals() { doTestNoNullCheck(); }
|
||||
|
||||
public void testQualifiedThisNotEqual() { doTest(); }
|
||||
public void testQualifiedSuperEqual() { doTest(); }
|
||||
@@ -66,8 +68,14 @@ public class EqualsReplaceableByObjectsCallFixTest extends IGQuickFixesTestCase
|
||||
@Override
|
||||
public void setUp() throws Exception {
|
||||
super.setUp();
|
||||
myFixture.enableInspections(new EqualsReplaceableByObjectsCallInspection());
|
||||
myInspection = new EqualsReplaceableByObjectsCallInspection();
|
||||
myFixture.enableInspections(myInspection);
|
||||
myRelativePath = "migration/equals_replaceable_by_objects_call";
|
||||
myDefaultHint = InspectionGadgetsBundle.message("equals.replaceable.by.objects.call.quickfix");
|
||||
}
|
||||
|
||||
private void doTestNoNullCheck() {
|
||||
myInspection.checkNotNull = false;
|
||||
doTest();
|
||||
}
|
||||
}
|
||||
|
||||
+10
-4
@@ -43,15 +43,21 @@ public class EqualsReplaceableByObjectsCallInspectionTest extends LightInspectio
|
||||
}
|
||||
|
||||
public void testEqualsReplaceableByObjectsCall() {
|
||||
doTest();
|
||||
testEqualsReplaceable(false);
|
||||
}
|
||||
|
||||
public void testEqualsReplaceableByObjectsCallCheckNull() {
|
||||
testEqualsReplaceable(true);
|
||||
}
|
||||
|
||||
protected void testEqualsReplaceable(boolean checkNotNull) {
|
||||
boolean oldNotNull = myInspection.checkNotNull;
|
||||
try {
|
||||
myInspection.checkNotNull = true;
|
||||
myInspection.checkNotNull = checkNotNull;
|
||||
doTest();
|
||||
} finally {
|
||||
myInspection.checkNotNull = false;
|
||||
}
|
||||
finally {
|
||||
myInspection.checkNotNull = oldNotNull;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user