boolean (@NotNull PsiSwitchBlock switchBlock) { final PsiSwitchBlock other = (PsiSwitchBlock)myMatchingVisitor.getElement(); if (!myMatchingVisitor.match(switchBlock.getExpression(), other.getExpression())) { return false; } final PsiCodeBlock body = switchBlock.getBody(); final PsiSwitchLabelStatementBase[] cases1 = PsiTreeUtil.getChildrenOfType(body, PsiSwitchLabelStatementBase.class); if (cases1 != null) { final PsiSwitchLabelStatementBase[] cases2 = PsiTreeUtil.getChildrenOfType(other.getBody(), PsiSwitchLabelStatementBase.class); return myMatchingVisitor.matchSequentially(cases1, cases2 != null ? cases2 : PsiElement.EMPTY_ARRAY); } final List<PsiElement> statements1 = PsiTreeUtil.getChildrenOfAnyType(body, PsiStatement.class, PsiComment.class); if (!statements1.isEmpty()) { final List<PsiElement> statements2 = PsiTreeUtil.getChildrenOfAnyType(other.getBody(), PsiStatement.class, PsiComment.class); return myMatchingVisitor.matchSequentially(statements1.toArray(PsiElement.EMPTY_ARRAY), statements2.toArray(PsiElement.EMPTY_ARRAY)); } return true; }