Match (@Nullable PsiCaseLabelElement element1, @Nullable PsiCaseLabelElement element2) { if (element1 == element2) { return EXACT_MATCH; } element1 = skipParenthesizedElementDown(element1); element2 = skipParenthesizedElementDown(element2); if (element1 == null || element2 == null) { return Match.exact(element1 == element2); } if (element1.getClass() != element2.getClass()) { return EXACT_MISMATCH; } if (element1 instanceof PsiDefaultCaseLabelElement) { return EXACT_MATCH; } if (element1 instanceof PsiPattern) { return patternsMatch((PsiPattern)element1, (PsiPattern)element2); } if (element1 instanceof PsiExpression) { return expressionsMatch((PsiExpression)element1, (PsiExpression)element2); } return null; }