About comment in method body

Hello @husky

If I understand correctly your question: no, there is no method available to get all comments present in the body of a method.

You can get them “by hand” though. There are probably different ways to do it, depending on your requirements. If you expect the comments to not be nested into statements, you can probably go for something like:

method.block().body().stream().flatMap(s -> s.firstToken().trivias().stream())

Note that this code will probably not work as it is (missing null check, …), but I hope it already gives you clues to continue your implementation.

Best,
Quentin