Throw an exception for suspending factory methods

Suspending factory methods are not supported, and can
have side effects, so it is better to fail explicitly
for such use case.

Closes gh-32719
This commit is contained in:
Sébastien Deleuze
2024-05-10 11:45:24 +02:00
parent a02861f7db
commit 7985ab33f4
9 changed files with 200 additions and 9 deletions

View File

@@ -720,7 +720,7 @@ public class MethodParameter {
else if (this.executable instanceof Constructor<?> constructor) {
parameterNames = discoverer.getParameterNames(constructor);
}
if (parameterNames != null) {
if (parameterNames != null && this.parameterIndex < parameterNames.length) {
this.parameterName = parameterNames[this.parameterIndex];
}
this.parameterNameDiscoverer = null;