mirror of
https://github.com/openjdk/jdk.git
synced 2025-08-27 06:45:07 +02:00
8259922: MethodHandles.collectArguments does not throw IAE if pos is outside the arity range
Reviewed-by: mchung
This commit is contained in:
parent
0ea5862670
commit
bf5e801501
2 changed files with 86 additions and 0 deletions
|
@ -5748,6 +5748,10 @@ assertEquals("[top, [[up, down, strange], charm], bottom]",
|
|||
MethodType filterType = filter.type();
|
||||
Class<?> rtype = filterType.returnType();
|
||||
List<Class<?>> filterArgs = filterType.parameterList();
|
||||
if (pos < 0 || (rtype == void.class && pos > targetType.parameterCount()) ||
|
||||
(rtype != void.class && pos >= targetType.parameterCount())) {
|
||||
throw newIllegalArgumentException("position is out of range for target", target, pos);
|
||||
}
|
||||
if (rtype == void.class) {
|
||||
return targetType.insertParameterTypes(pos, filterArgs);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue