Match (@NotNull PsiSwitchLabelStatementBase statement1, @NotNull PsiSwitchLabelStatementBase statement2) { boolean hasOnlyDefaultCase = SwitchUtils.hasOnlyDefaultCase(statement1); if (hasOnlyDefaultCase != SwitchUtils.hasOnlyDefaultCase(statement2)) { return EXACT_MISMATCH; } final PsiCaseLabelElementList labelElementList1 = hasOnlyDefaultCase ? null : statement1.getCaseLabelElementList(); final PsiCaseLabelElementList labelElementList2 = hasOnlyDefaultCase ? null : statement2.getCaseLabelElementList(); if ((labelElementList1 == null || labelElementList2 == null) && labelElementList1 != labelElementList2) { return EXACT_MISMATCH; } PsiCaseLabelElement[] labelElements1 = labelElementList1 != null ? labelElementList1.getElements() : PsiCaseLabelElement.EMPTY_ARRAY; PsiCaseLabelElement[] labelElements2 = labelElementList2 != null ? labelElementList2.getElements() : PsiCaseLabelElement.EMPTY_ARRAY; if (!labelElementsAreEquivalent(labelElements1, labelElements2, true).isExactMatch()) { return EXACT_MISMATCH; } PsiExpression guard1 = statement1.getGuardExpression(); PsiExpression guard2 = statement2.getGuardExpression(); if (!expressionsAreEquivalent(guard1, guard2)) { return EXACT_MISMATCH; } final boolean rule1 = statement1 instanceof PsiSwitchLabeledRuleStatement; final boolean rule2 = statement2 instanceof PsiSwitchLabeledRuleStatement; if (rule1 && rule2) { final PsiSwitchLabeledRuleStatement switchLabeledRuleStatement1 = (PsiSwitchLabeledRuleStatement)statement1; final PsiSwitchLabeledRuleStatement switchLabeledRuleStatement2 = (PsiSwitchLabeledRuleStatement)statement2; if (!statementsAreEquivalent(switchLabeledRuleStatement1.getBody(), switchLabeledRuleStatement2.getBody())) { return EXACT_MISMATCH; } } else if (rule1 || rule2) { return EXACT_MISMATCH; } return EXACT_MATCH; }