Hi there,
One of our project has started using AspectJ’s @Pointcut annotation. Eg:
@Pointcut("within(com.package.Service+)")
private void isMyService() {}
Such methods tend to be empty, so naturally Sonar complains about:
- Methods should not be empty (S1186)
- “private” methods that don’t access instance data should be “static” (S2325)
I know we have multiple options to deal with this: for S1186 we can add a comment which might anyway help point out what the empty method is for. For S2325 we could simply disable the rule in such cases.
I was wondering however if you have considered handling such AOP cases and ignoring the empty method.
It seems this was done for the “unused methods” rule in the past: https://groups.google.com/forum/#!searchin/sonarqube/pointcut|sort:date/sonarqube/4nJ-8VYOTuo/Tb1AnQC2AAAJ so it would be nice to have the same behavior for other rules affected.
Thanks and cheers,
Sandro