mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
DuplicateConditionInspection: ignoreMethodCalls -> ignoreSideEffectConditions, description updated
Review ID: IDEA-CR-20980
This commit is contained in:
+3
-3
@@ -37,7 +37,7 @@ public class DuplicateConditionInspection extends BaseInspection {
|
||||
/**
|
||||
* @noinspection PublicField
|
||||
*/
|
||||
public boolean ignoreMethodCalls = true;
|
||||
public boolean ignoreSideEffectConditions = true;
|
||||
|
||||
// This is a dirty fix of 'squared' algorithm performance issue.
|
||||
private static final int LIMIT_DEPTH = 20;
|
||||
@@ -58,7 +58,7 @@ public class DuplicateConditionInspection extends BaseInspection {
|
||||
@Nullable
|
||||
public JComponent createOptionsPanel() {
|
||||
return new SingleCheckboxOptionsPanel(InspectionGadgetsBundle.message("duplicate.condition.ignore.method.calls.option"),
|
||||
this, "ignoreMethodCalls");
|
||||
this, "ignoreSideEffectConditions");
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -82,7 +82,7 @@ public class DuplicateConditionInspection extends BaseInspection {
|
||||
return;
|
||||
}
|
||||
final List<PsiExpression> conditionList = new ArrayList<>(conditions);
|
||||
if (ignoreMethodCalls) {
|
||||
if (ignoreSideEffectConditions) {
|
||||
conditionList.replaceAll(cond -> SideEffectChecker.mayHaveSideEffects(cond) ? null : cond);
|
||||
// Every condition having side-effect separates non-side-effect conditions into independent groups
|
||||
// like:
|
||||
|
||||
@@ -5,8 +5,8 @@ Reports on any duplicate conditions among different branches of an
|
||||
desired semantics, duplicate conditions usually represent programmer oversight.
|
||||
<!-- tooltip end -->
|
||||
<p>
|
||||
Use the checkbox below to let this inspection ignore conditions containing method calls. Some method calls may return a different value
|
||||
on an identical invocation.
|
||||
Use the checkbox below to let this inspection ignore conditions which may produce side effects.
|
||||
Unchecking this checkbox may lead to some false-positives, e.g. when the same method call returns different values on subsequent invocations.
|
||||
<p>
|
||||
|
||||
</body>
|
||||
|
||||
+1
-1
@@ -17,7 +17,7 @@ public class DuplicateConditionInspectionTest extends LightInspectionTestCase {
|
||||
@Override
|
||||
protected InspectionProfileEntry getInspection() {
|
||||
DuplicateConditionInspection inspection = new DuplicateConditionInspection();
|
||||
inspection.ignoreMethodCalls = getTestName(false).contains("NoSideEffect");
|
||||
inspection.ignoreSideEffectConditions = getTestName(false).contains("NoSideEffect");
|
||||
return inspection;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user