Skip to content

Commit

Permalink
Exclude LocalVariableTableParameterNameDiscoverer based on native ima…
Browse files Browse the repository at this point in the history
…ge check

See gh-29531
  • Loading branch information
jhoeller committed Nov 22, 2022
1 parent d32027d commit 7816c9e
Showing 1 changed file with 3 additions and 5 deletions.
Expand Up @@ -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.
*
* <p>If a Kotlin reflection implementation is present,
* {@link KotlinReflectionParameterNameDiscoverer} is added first in the list and
Expand All @@ -45,7 +43,7 @@ public DefaultParameterNameDiscoverer() {
addDiscoverer(new KotlinReflectionParameterNameDiscoverer());
}
addDiscoverer(new StandardReflectionParameterNameDiscoverer());
if (!AotDetector.useGeneratedArtifacts()) {
if (!NativeDetector.inNativeImage()) {
addDiscoverer(new LocalVariableTableParameterNameDiscoverer());
}
}
Expand Down

0 comments on commit 7816c9e

Please sign in to comment.