Document need for -parameters flag in exception messages
Closes gh-31675
This commit is contained in:
@@ -152,9 +152,10 @@ public abstract class AbstractNamedValueMethodArgumentResolver implements SyncHa
|
||||
if (info.name.isEmpty()) {
|
||||
name = parameter.getParameterName();
|
||||
if (name == null) {
|
||||
throw new IllegalArgumentException(
|
||||
"Name for argument of type [" + parameter.getNestedParameterType().getName() +
|
||||
"] not specified, and parameter name information not found in class file either.");
|
||||
throw new IllegalArgumentException("""
|
||||
Name for argument of type [%s] not specified, and parameter name information not \
|
||||
available via reflection. Ensure that the compiler uses the '-parameters' flag."""
|
||||
.formatted(parameter.getNestedParameterType().getName()));
|
||||
}
|
||||
}
|
||||
return new NamedValueInfo(name, info.required,
|
||||
|
||||
@@ -162,9 +162,10 @@ public abstract class AbstractNamedValueMethodArgumentResolver implements Handle
|
||||
if (info.name.isEmpty()) {
|
||||
name = parameter.getParameterName();
|
||||
if (name == null) {
|
||||
throw new IllegalArgumentException(
|
||||
"Name for argument of type [" + parameter.getNestedParameterType().getName() +
|
||||
"] not specified, and parameter name information not found in class file either.");
|
||||
throw new IllegalArgumentException("""
|
||||
Name for argument of type [%s] not specified, and parameter name information not \
|
||||
available via reflection. Ensure that the compiler uses the '-parameters' flag."""
|
||||
.formatted(parameter.getNestedParameterType().getName()));
|
||||
}
|
||||
}
|
||||
return new NamedValueInfo(name, info.required,
|
||||
|
||||
Reference in New Issue
Block a user