How to explicitly comment empty methods?
Solution 1:
When you have a method with an empty body, it is possible that you started writing the method and then forgot to insert the body. If you intend for the method to be empty, you should make a note (in a comment) to explain that it's empty on purpose. In the case of Filter
, since you have to implement the destroy()
method, you should write a comment that says something like "nothing to clean up".
Solution 2:
It means - in PMD terms - that you have to leave a comment inside an empty method, so it's obvious that the method is meant to be empty.
You can comment the outside of the method as well if you like, but this won't satisfy PMD.
Solution 3:
the warning pretty much explain itself.
when you leave an empty method, you should leave a comment saying why is it empty, who did it and when/who is responsible to write it. that way users know why is it here and who should use it, and why isn't it working