void (@NotNull PsiSwitchLabelStatementBase label, @NotNull Project project) { PsiElementFactory factory = PsiElementFactory.getInstance(project); if (label instanceof PsiSwitchLabelStatement) { PsiSwitchLabelStatementBase defaultLabel = (PsiSwitchLabelStatement)factory.createStatementFromText("default:", null); new CommentTracker().replaceAndRestoreComments(label, defaultLabel); } else if (label instanceof PsiSwitchLabeledRuleStatement rule) { PsiSwitchLabeledRuleStatement defaultLabel = (PsiSwitchLabeledRuleStatement)factory.createStatementFromText("default->{}", null); PsiStatement body = rule.getBody(); assert body != null; Objects.requireNonNull(defaultLabel.getBody()).replace(body); new CommentTracker().replaceAndRestoreComments(label, defaultLabel); } else { assert false; } }