String (@NotNull PsiSwitchLabeledRuleStatement rule, @NotNull CommentTracker ct) { List<String> lists = new ArrayList<>(); PsiElement previous = rule.getPrevSibling(); while (true) { if (previous instanceof PsiComment || previous instanceof PsiWhiteSpace) { lists.add(ct.text(previous)); previous = previous.getPrevSibling(); } else { break; } } Collections.reverse(lists); return String.join("", lists); }