Methods should not be empty (java:S1186) in AspectJ @Pointct


I’m sorry to bring up this topic that was already closed ( @Pointcut vs. S1186 & S2325 - Report a False-positive / False-negative, and it’s associated jira ticket, [SONARJAVA-3668] FP on S1186: method annotated @Pointcut from AspectJ are often expected to be empty.

However, I don’t accept the “solution” on the topic that " some developers comment these methods to explain why they are empty. Thus the rule still seems to make sense for them."

Sure, adding a comment so that SonarLint stops calling out the “critical code smell” is easy enough for one or 2 Pointcut methods, but if you have a lot, the code can become cluttered with these repeated comments for each Pointcut method.

Therefore, I would think that a compliant solution would include methods annotated with Pointcut (in addition to adding a nested comment or throwing UnsupportedOperationException.

Hi @englio15 and welcome to the community,
I see your point that not all developers are actually commenting in empty methods annotated with @Pointcut.
I have re-opened the ticket (but keep in mind that this will probably not be a priority).