From 7816c9e411578493407533315030c476daf160c3 Mon Sep 17 00:00:00 2001 From: Juergen Hoeller Date: Tue, 22 Nov 2022 15:37:00 +0100 Subject: [PATCH] Exclude LocalVariableTableParameterNameDiscoverer based on native image check See gh-29531 --- .../core/DefaultParameterNameDiscoverer.java | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/spring-core/src/main/java/org/springframework/core/DefaultParameterNameDiscoverer.java b/spring-core/src/main/java/org/springframework/core/DefaultParameterNameDiscoverer.java index 73e1f40dea..11b68ace14 100644 --- a/spring-core/src/main/java/org/springframework/core/DefaultParameterNameDiscoverer.java +++ b/spring-core/src/main/java/org/springframework/core/DefaultParameterNameDiscoverer.java @@ -16,13 +16,11 @@ package org.springframework.core; -import org.springframework.aot.AotDetector; - /** * Default implementation of the {@link ParameterNameDiscoverer} strategy interface, * using the Java 8 standard reflection mechanism (if available), and falling back - * to the ASM-based {@link LocalVariableTableParameterNameDiscoverer} (when not using - * AOT-processed optimizations) for checking debug information in the class file. + * to the ASM-based {@link LocalVariableTableParameterNameDiscoverer} (when not in + * a native image) for checking debug information in the class file. * *

If a Kotlin reflection implementation is present, * {@link KotlinReflectionParameterNameDiscoverer} is added first in the list and @@ -45,7 +43,7 @@ public class DefaultParameterNameDiscoverer extends PrioritizedParameterNameDisc addDiscoverer(new KotlinReflectionParameterNameDiscoverer()); } addDiscoverer(new StandardReflectionParameterNameDiscoverer()); - if (!AotDetector.useGeneratedArtifacts()) { + if (!NativeDetector.inNativeImage()) { addDiscoverer(new LocalVariableTableParameterNameDiscoverer()); } }