From 43409b00d08bac48a477668d0bb54ec9f7e4603b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Deleuze?= Date: Mon, 3 Jun 2024 18:57:56 +0200 Subject: [PATCH] Refine KotlinDetector.isKotlinType documentation This commit documents changes in lambda detection as of Kotlin 2.0. Closes gh-32905 --- .../main/java/org/springframework/core/KotlinDetector.java | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/spring-core/src/main/java/org/springframework/core/KotlinDetector.java b/spring-core/src/main/java/org/springframework/core/KotlinDetector.java index 80d8d658afe..696ee372b00 100644 --- a/spring-core/src/main/java/org/springframework/core/KotlinDetector.java +++ b/spring-core/src/main/java/org/springframework/core/KotlinDetector.java @@ -84,6 +84,10 @@ public abstract class KotlinDetector { /** * Determine whether the given {@code Class} is a Kotlin type * (with Kotlin metadata present on it). + * + *

As of Kotlin 2.0, this method can't be used to detect Kotlin + * lambdas unless they are annotated with @JvmSerializableLambda + * as invokedynamic has become the default method for lambda generation. */ public static boolean isKotlinType(Class clazz) { return (kotlinMetadata != null && clazz.getDeclaredAnnotation(kotlinMetadata) != null);