[False Positive] When using @PointCut annotations from AspectJ

154 views
Skip to first unread message

bobb...@gmail.com

unread,
Oct 30, 2015, 11:35:54 AM10/30/15
to SonarQube
In the following setup the publicMethods method is identified as unused method.

@Pointcut("within(@org.springframework.stereotype.Repository *)")
public void beanAnnotatedWithRepository() {
 
//Selector for Repository annotated classes
}


@Pointcut("execution(public * *(..))")
private void publicMethod() {
 
//Selector for public methods
}


@Around("publicMethod() && beanAnnotatedWithRepository()")
public Object injectCassandraConntion(ProceedingJoinPoint pjp) throws Throwable {
 
//some implementation
}


Michael Gumowski

unread,
Feb 26, 2016, 4:05:41 AM2/26/16
to Bob Brinks, SonarQube
Hello Bob,

First, sorry for the delay answering you, but thank you for your feedback! 
Indeed, this is a FP. The rule currently totally ignores the fact that the method will rely on aspect for its calling. I created the following ticket to handle the issue: https://jira.sonarsource.com/browse/SONARJAVA-1559

Regards,

Michael GUMOWSKI | SonarSource
Software Developer @ Language Team
http://sonarsource.com

--
You received this message because you are subscribed to the Google Groups "SonarQube" group.
To unsubscribe from this group and stop receiving emails from it, send an email to sonarqube+...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/sonarqube/7035f793-d011-4bc8-a5d1-39518e43b0f5%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply all
Reply to author
Forward
0 new messages