From f8fa9d6018c624eed07ee4f3a55b88cdcb16f3b0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Deleuze?= Date: Sun, 20 Nov 2022 16:50:32 +0100 Subject: [PATCH] Do not use LocalVariableTableParameterNameDiscoverer in native images --- .../core/DefaultParameterNameDiscoverer.java | 9 ++++++--- 1 file changed, 6 insertions(+), 3 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 67dd75e44919..ed4d886bc97e 100644 --- a/spring-core/src/main/java/org/springframework/core/DefaultParameterNameDiscoverer.java +++ b/spring-core/src/main/java/org/springframework/core/DefaultParameterNameDiscoverer.java @@ -19,8 +19,9 @@ /** * 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} for checking - * debug information in the class file. + * on the JVM (not in native images) to the ASM-based + * {@link LocalVariableTableParameterNameDiscoverer} for checking debug information + * in the class file. * *

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