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.

Closes gh-31015
  • Loading branch information
sdeleuze committed Aug 10, 2023
1 parent 1c6ef3f commit 0c15be0
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
6 changes: 3 additions & 3 deletions framework-docs/modules/ROOT/pages/core/aop/schema.adoc
Expand Up @@ -435,7 +435,7 @@ Kotlin::
+
[source,kotlin,indent=0,subs="verbatim",role="secondary"]
----
fun doBasicProfiling(pjp: ProceedingJoinPoint): Any {
fun doBasicProfiling(pjp: ProceedingJoinPoint): Any? {
// start stopwatch
val retVal = pjp.proceed()
// stop stopwatch
Expand Down Expand Up @@ -554,7 +554,7 @@ Kotlin::
class SimpleProfiler {
fun profile(call: ProceedingJoinPoint, name: String, age: Int): Any {
fun profile(call: ProceedingJoinPoint, name: String, age: Int): Any? {
val clock = StopWatch("Profiling for '$name' and '$age'")
try {
clock.start(call.toShortString())
Expand Down Expand Up @@ -890,7 +890,7 @@ Kotlin::
this.order = order
}
fun doConcurrentOperation(pjp: ProceedingJoinPoint): Any {
fun doConcurrentOperation(pjp: ProceedingJoinPoint): Any? {
var numAttempts = 0
var lockFailureException: PessimisticLockingFailureException
do {
Expand Down
Expand Up @@ -493,7 +493,7 @@ Kotlin::
class ProfilingAspect {
@Around("methodsToBeProfiled()")
fun profile(pjp: ProceedingJoinPoint): Any {
fun profile(pjp: ProceedingJoinPoint): Any? {
val sw = StopWatch(javaClass.simpleName)
try {
sw.start(pjp.getSignature().getName())
Expand Down

0 comments on commit 0c15be0

Please sign in to comment.