void (@NotNull PsiCaseLabelElementList list) { PsiSwitchBlock switchBlock = PsiTreeUtil.getParentOfType(list, PsiSwitchBlock.class); if (switchBlock == null) return; PsiExpression selector = switchBlock.getExpression(); PsiModifierListOwner owner = null; if (selector instanceof PsiReference ref) { owner = ObjectUtils.tryCast(ref.resolve(), PsiModifierListOwner.class); } else if (selector instanceof PsiMethodCallExpression call) { owner = call.resolveMethod(); } if (owner == null) return; for (PsiCaseLabelElement element : list.getElements()) { if (element instanceof PsiExpression expression) { checkExpression(expression, owner, PsiUtil.getTypeByPsiElement(owner), holder); } } }