mirror of
https://github.com/openjdk/jdk.git
synced 2025-08-27 14:54:52 +02:00
Merge
This commit is contained in:
commit
8f528fba93
608 changed files with 7528 additions and 3300 deletions
|
@ -1667,6 +1667,7 @@ assertEquals("[three, thee, tee]", asListFix.invoke((Object)argv).toString());
|
|||
/** Craft a LambdaForm customized for this particular MethodHandle */
|
||||
/*non-public*/
|
||||
void customize() {
|
||||
final LambdaForm form = this.form;
|
||||
if (form.customized == null) {
|
||||
LambdaForm newForm = form.customize(this);
|
||||
updateForm(newForm);
|
||||
|
|
|
@ -3766,6 +3766,7 @@ assertEquals("xy", h3.invoke("x", "y", 1, "a", "b", "c"));
|
|||
* specified in the elements of the {@code filters} array.
|
||||
* The first element of the filter array corresponds to the {@code pos}
|
||||
* argument of the target, and so on in sequence.
|
||||
* The filter functions are invoked in left to right order.
|
||||
* <p>
|
||||
* Null arguments in the array are treated as identity functions,
|
||||
* and the corresponding arguments left unchanged.
|
||||
|
@ -3836,11 +3837,12 @@ assertEquals("XY", (String) f2.invokeExact("x", "y")); // XY
|
|||
MethodHandle filterArguments(MethodHandle target, int pos, MethodHandle... filters) {
|
||||
filterArgumentsCheckArity(target, pos, filters);
|
||||
MethodHandle adapter = target;
|
||||
int curPos = pos-1; // pre-incremented
|
||||
for (MethodHandle filter : filters) {
|
||||
curPos += 1;
|
||||
// process filters in reverse order so that the invocation of
|
||||
// the resulting adapter will invoke the filters in left-to-right order
|
||||
for (int i = filters.length - 1; i >= 0; --i) {
|
||||
MethodHandle filter = filters[i];
|
||||
if (filter == null) continue; // ignore null elements of filters
|
||||
adapter = filterArgument(adapter, curPos, filter);
|
||||
adapter = filterArgument(adapter, pos + i, filter);
|
||||
}
|
||||
return adapter;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue