File tree Expand file tree Collapse file tree 1 file changed +11
-5
lines changed
spring-core/src/main/java/org/springframework/core Expand file tree Collapse file tree 1 file changed +11
-5
lines changed Original file line number Diff line number Diff line change 2525 * debug information in the class file.
2626 *
2727 * <p>If Kotlin is present, {@link KotlinReflectionParameterNameDiscoverer} is added first
28- * in the list and used for Kotlin classes and interfaces.
28+ * in the list and used for Kotlin classes and interfaces. When compiling or running as
29+ * a Graal native image, no {@link ParameterNameDiscoverer} is used.
2930 *
3031 * <p>Further discoverers may be added through {@link #addDiscoverer(ParameterNameDiscoverer)}.
3132 *
@@ -41,13 +42,18 @@ public class DefaultParameterNameDiscoverer extends PrioritizedParameterNameDisc
4142 private static final boolean kotlinPresent =
4243 ClassUtils .isPresent ("kotlin.Unit" , DefaultParameterNameDiscoverer .class .getClassLoader ());
4344
45+ // See https://github.com/oracle/graal/blob/master/sdk/src/org.graalvm.nativeimage/src/org/graalvm/nativeimage/ImageInfo.java
46+ private static final boolean inImageCode = (System .getProperty ("org.graalvm.nativeimage.imagecode" ) != null );
47+
4448
4549 public DefaultParameterNameDiscoverer () {
46- if (kotlinPresent ) {
47- addDiscoverer (new KotlinReflectionParameterNameDiscoverer ());
50+ if (!inImageCode ) {
51+ if (kotlinPresent ) {
52+ addDiscoverer (new KotlinReflectionParameterNameDiscoverer ());
53+ }
54+ addDiscoverer (new StandardReflectionParameterNameDiscoverer ());
55+ addDiscoverer (new LocalVariableTableParameterNameDiscoverer ());
4856 }
49- addDiscoverer (new StandardReflectionParameterNameDiscoverer ());
50- addDiscoverer (new LocalVariableTableParameterNameDiscoverer ());
5157 }
5258
5359}
You can’t perform that action at this time.
0 commit comments