Skip to content

Commit

Permalink
Use Any? in ProceedingJoinPoint Kotlin examples
Browse files Browse the repository at this point in the history
This commit changes Any to Any? in ProceedingJoinPoint
Kotlin examples in order to be consistent with Java
and avoid a "NullPointerException: pjp.proceed() must
not be null" error.

See spring-projectsgh-31015
  • Loading branch information
pstrsr authored and sdeleuze committed Aug 10, 2023
1 parent d254bff commit 1c6ef3f
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
Expand Up @@ -176,7 +176,7 @@ Kotlin::
@AfterReturning(
pointcut = "execution(* com.xyz.dao.*.*(..))",
returning = "retVal")
fun doAccessCheck(retVal: Any) {
fun doAccessCheck(retVal: Any?) {
// ...
}
}
Expand Down Expand Up @@ -448,7 +448,7 @@ Kotlin::
class AroundExample {
@Around("execution(* com.xyz..service.*.*(..))")
fun doBasicProfiling(pjp: ProceedingJoinPoint): Any {
fun doBasicProfiling(pjp: ProceedingJoinPoint): Any? {
// start stopwatch
val retVal = pjp.proceed()
// stop stopwatch
Expand Down Expand Up @@ -893,7 +893,7 @@ Kotlin::
"com.xyz.CommonPointcuts.inDataAccessLayer() && " +
"args(accountHolderNamePattern)") // <1>
fun preProcessQueryPattern(pjp: ProceedingJoinPoint,
accountHolderNamePattern: String): Any {
accountHolderNamePattern: String): Any? {
val newPattern = preProcess(accountHolderNamePattern)
return pjp.proceed(arrayOf<Any>(newPattern))
}
Expand Down
Expand Up @@ -85,7 +85,7 @@ Kotlin::
}
@Around("com.xyz.CommonPointcuts.businessService()") // <1>
fun doConcurrentOperation(pjp: ProceedingJoinPoint): Any {
fun doConcurrentOperation(pjp: ProceedingJoinPoint): Any? {
var numAttempts = 0
var lockFailureException: PessimisticLockingFailureException
do {
Expand Down Expand Up @@ -173,7 +173,7 @@ Kotlin::
----
@Around("execution(* com.xyz..service.*.*(..)) && " +
"@annotation(com.xyz.service.Idempotent)")
fun doConcurrentOperation(pjp: ProceedingJoinPoint): Any {
fun doConcurrentOperation(pjp: ProceedingJoinPoint): Any? {
// ...
}
----
Expand Down

0 comments on commit 1c6ef3f

Please sign in to comment.