Skip to content

Commit 1c6ef3f

Browse files
pstrsrsdeleuze
authored andcommitted
Use Any? in ProceedingJoinPoint Kotlin examples
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 gh-31015
1 parent d254bff commit 1c6ef3f

File tree

2 files changed

+5
-5
lines changed

2 files changed

+5
-5
lines changed

framework-docs/modules/ROOT/pages/core/aop/ataspectj/advice.adoc

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -176,7 +176,7 @@ Kotlin::
176176
@AfterReturning(
177177
pointcut = "execution(* com.xyz.dao.*.*(..))",
178178
returning = "retVal")
179-
fun doAccessCheck(retVal: Any) {
179+
fun doAccessCheck(retVal: Any?) {
180180
// ...
181181
}
182182
}
@@ -448,7 +448,7 @@ Kotlin::
448448
class AroundExample {
449449
450450
@Around("execution(* com.xyz..service.*.*(..))")
451-
fun doBasicProfiling(pjp: ProceedingJoinPoint): Any {
451+
fun doBasicProfiling(pjp: ProceedingJoinPoint): Any? {
452452
// start stopwatch
453453
val retVal = pjp.proceed()
454454
// stop stopwatch
@@ -893,7 +893,7 @@ Kotlin::
893893
"com.xyz.CommonPointcuts.inDataAccessLayer() && " +
894894
"args(accountHolderNamePattern)") // <1>
895895
fun preProcessQueryPattern(pjp: ProceedingJoinPoint,
896-
accountHolderNamePattern: String): Any {
896+
accountHolderNamePattern: String): Any? {
897897
val newPattern = preProcess(accountHolderNamePattern)
898898
return pjp.proceed(arrayOf<Any>(newPattern))
899899
}

framework-docs/modules/ROOT/pages/core/aop/ataspectj/example.adoc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ Kotlin::
8585
}
8686
8787
@Around("com.xyz.CommonPointcuts.businessService()") // <1>
88-
fun doConcurrentOperation(pjp: ProceedingJoinPoint): Any {
88+
fun doConcurrentOperation(pjp: ProceedingJoinPoint): Any? {
8989
var numAttempts = 0
9090
var lockFailureException: PessimisticLockingFailureException
9191
do {
@@ -173,7 +173,7 @@ Kotlin::
173173
----
174174
@Around("execution(* com.xyz..service.*.*(..)) && " +
175175
"@annotation(com.xyz.service.Idempotent)")
176-
fun doConcurrentOperation(pjp: ProceedingJoinPoint): Any {
176+
fun doConcurrentOperation(pjp: ProceedingJoinPoint): Any? {
177177
// ...
178178
}
179179
----

0 commit comments

Comments
 (0)