Skip to content

Commit 71bbabc

Browse files
committed
Do not use LocalVariableTableParameterNameDiscoverer in AOT mode
1 parent da12481 commit 71bbabc

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

spring-core/src/main/java/org/springframework/core/DefaultParameterNameDiscoverer.java

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,11 +16,13 @@
1616

1717
package org.springframework.core;
1818

19+
import org.springframework.aot.AotDetector;
20+
1921
/**
2022
* Default implementation of the {@link ParameterNameDiscoverer} strategy interface,
2123
* using the Java 8 standard reflection mechanism (if available), and falling back
22-
* to the ASM-based {@link LocalVariableTableParameterNameDiscoverer} for checking
23-
* debug information in the class file.
24+
* to the ASM-based {@link LocalVariableTableParameterNameDiscoverer} (when not using
25+
* AOT-processed optimizations) for checking debug information in the class file.
2426
*
2527
* <p>If a Kotlin reflection implementation is present,
2628
* {@link KotlinReflectionParameterNameDiscoverer} is added first in the list and
@@ -43,7 +45,9 @@ public DefaultParameterNameDiscoverer() {
4345
addDiscoverer(new KotlinReflectionParameterNameDiscoverer());
4446
}
4547
addDiscoverer(new StandardReflectionParameterNameDiscoverer());
46-
addDiscoverer(new LocalVariableTableParameterNameDiscoverer());
48+
if (!AotDetector.useGeneratedArtifacts()) {
49+
addDiscoverer(new LocalVariableTableParameterNameDiscoverer());
50+
}
4751
}
4852

4953
}

0 commit comments

Comments
 (0)