Suspend Proceeding Join Point
The suspend counterpart of ProceedingJoinPoint.
When an Around-annotated advice targets a suspend function, the advice must itself be declared suspend and accept a SuspendProceedingJoinPoint instead of a ProceedingJoinPoint, because proceed resumes the original suspending body and therefore has to suspend too.
Usage
@Around(target = [Timed::class])
suspend fun measureTime(jp: SuspendProceedingJoinPoint): Any? {
val start = currentTimeMillis()
val result = jp.proceed()
println("Elapsed: ${currentTimeMillis() - start} ms")
return result
}A non-suspending target still uses ProceedingJoinPoint; the AspectK compiler plugin picks the right join point type based on whether the intercepted function is suspend.
See also
Types
SAM interface used by the AspectK compiler plugin to bridge the wrapper lambda generated at each intercepted call site with proceed.
Properties
Functions
Returns the AnnotationInfo for annotation T present on the intercepted function, or null if no such annotation is present.
Returns JoinPoint.target cast to T, or null if the target is null or cannot be cast to T.