Skip to content

Commit 0c15be0

Browse files
committed
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. Closes gh-31015
1 parent 1c6ef3f commit 0c15be0

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

framework-docs/modules/ROOT/pages/core/aop/schema.adoc

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -435,7 +435,7 @@ Kotlin::
435435
+
436436
[source,kotlin,indent=0,subs="verbatim",role="secondary"]
437437
----
438-
fun doBasicProfiling(pjp: ProceedingJoinPoint): Any {
438+
fun doBasicProfiling(pjp: ProceedingJoinPoint): Any? {
439439
// start stopwatch
440440
val retVal = pjp.proceed()
441441
// stop stopwatch
@@ -554,7 +554,7 @@ Kotlin::
554554
555555
class SimpleProfiler {
556556
557-
fun profile(call: ProceedingJoinPoint, name: String, age: Int): Any {
557+
fun profile(call: ProceedingJoinPoint, name: String, age: Int): Any? {
558558
val clock = StopWatch("Profiling for '$name' and '$age'")
559559
try {
560560
clock.start(call.toShortString())
@@ -890,7 +890,7 @@ Kotlin::
890890
this.order = order
891891
}
892892
893-
fun doConcurrentOperation(pjp: ProceedingJoinPoint): Any {
893+
fun doConcurrentOperation(pjp: ProceedingJoinPoint): Any? {
894894
var numAttempts = 0
895895
var lockFailureException: PessimisticLockingFailureException
896896
do {

framework-docs/modules/ROOT/pages/core/aop/using-aspectj.adoc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -493,7 +493,7 @@ Kotlin::
493493
class ProfilingAspect {
494494
495495
@Around("methodsToBeProfiled()")
496-
fun profile(pjp: ProceedingJoinPoint): Any {
496+
fun profile(pjp: ProceedingJoinPoint): Any? {
497497
val sw = StopWatch(javaClass.simpleName)
498498
try {
499499
sw.start(pjp.getSignature().getName())

0 commit comments

Comments
 (0)