void (@NotNull List<GrDocCommentOwner> owners, @NonNls List<GrDocComment> danglingDocComments, @NotNull Consumer<? super @NotNull PsiDocCommentBase> sink) { for (var docComment : danglingDocComments) { if (docComment != null) { sink.accept(docComment); } } for (var owner : owners) { if (owner == null) { continue; } GrDocComment comment = owner.getDocComment(); if (comment != null) { sink.accept(comment); } if (owner instanceof GrTypeDefinition) { var nestedComments = PsiTreeUtil.getChildrenOfTypeAsList(((GrTypeDefinition)owner).getBody(), GrDocComment.class); var nestedOwners = PsiTreeUtil.getChildrenOfTypeAsList(((GrTypeDefinition)owner).getBody(), GrDocCommentOwner.class); processDocComments(nestedOwners, nestedComments, sink); } } }