Summary
Spring AOP uses @Aspect classes with pointcut expressions to intercept method calls at runtime. These relationships are currently invisible in CRG.
@Aspect
@Component
public class LoggingAspect {
@Around("execution(* com.example.service.*.*(..))")
public Object logAround(ProceedingJoinPoint joinPoint) throws Throwable {
// wraps every method in com.example.service
}
}
Proposed approach
Emit CALLS edges from aspect methods to matched target methods by parsing AspectJ pointcut expressions.
Parse phase:
- Detect
@Aspect class
- Extract pointcut strings from
@Around / @Before / @After / @AfterReturning / @AfterThrowing
- Parse the AspectJ
execution() pattern and match against method nodes in the graph
Complexity considerations
AspectJ pointcut expressions are a rich DSL (wildcards, boolean operators, annotations, named references). Options:
- Regex approximation — handle
execution() pattern covering ~80% of real-world cases; explicitly unsupported for call(), within(), named pointcuts
- External library — depend on an AspectJ parsing library if license compatible
- Metadata-only — emit a node
ASPECT::LoggingAspect with the pointcut string in extra, no CALLS edges; lets users query via get_knowledge_gaps
Option 1 is the most pragmatic starting point and suitable as a PR. Happy to implement if the maintainers are interested in this direction.
Related PRs (same Spring annotation series)
Summary
Spring AOP uses
@Aspectclasses with pointcut expressions to intercept method calls at runtime. These relationships are currently invisible in CRG.Proposed approach
Emit
CALLSedges from aspect methods to matched target methods by parsing AspectJ pointcut expressions.Parse phase:
@Aspectclass@Around/@Before/@After/@AfterReturning/@AfterThrowingexecution()pattern and match against method nodes in the graphComplexity considerations
AspectJ pointcut expressions are a rich DSL (wildcards, boolean operators, annotations, named references). Options:
execution()pattern covering ~80% of real-world cases; explicitly unsupported forcall(),within(), named pointcutsASPECT::LoggingAspectwith the pointcut string inextra, no CALLS edges; lets users query viaget_knowledge_gapsOption 1 is the most pragmatic starting point and suitable as a PR. Happy to implement if the maintainers are interested in this direction.
Related PRs (same Spring annotation series)
@RequiredArgsConstructor/@AllArgsConstructorDI semantics fix@ScheduledTRIGGERS edges@EventListenerHANDLES/PUBLISHES/CALLS edges