src/java.base/share/classes/java/lang/invoke/MethodHandle.java
Index
Unified diffs
Context diffs
Sdiffs
Patch
New
Old
Previous File
Next File
jdk Cdiff src/java.base/share/classes/java/lang/invoke/MethodHandle.java
src/java.base/share/classes/java/lang/invoke/MethodHandle.java
Print this page
rev 10938 : [mq]: remove.use_lf_editor
*** 865,883 ****
*/
public MethodHandle asSpreader(Class<?> arrayType, int arrayLength) {
MethodType postSpreadType = asSpreaderChecks(arrayType, arrayLength);
int arity = type().parameterCount();
int spreadArgPos = arity - arrayLength;
- if (USE_LAMBDA_FORM_EDITOR) {
MethodHandle afterSpread = this.asType(postSpreadType);
BoundMethodHandle mh = afterSpread.rebind();
LambdaForm lform = mh.editor().spreadArgumentsForm(1 + spreadArgPos, arrayType, arrayLength);
MethodType preSpreadType = postSpreadType.replaceParameterTypes(spreadArgPos, arity, arrayType);
return mh.copyWith(preSpreadType, lform);
- } else {
- return MethodHandleImpl.makeSpreadArguments(this, arrayType, spreadArgPos, arrayLength);
- }
}
/**
* See if {@code asSpreader} can be validly called with the given arguments.
* Return the type of the method handle call after spreading but before conversions.
--- 865,879 ----
*** 994,1020 ****
* @see #asVarargsCollector
*/
public MethodHandle asCollector(Class<?> arrayType, int arrayLength) {
asCollectorChecks(arrayType, arrayLength);
int collectArgPos = type().parameterCount() - 1;
- if (USE_LAMBDA_FORM_EDITOR) {
BoundMethodHandle mh = rebind();
MethodType resultType = type().asCollectorType(arrayType, arrayLength);
MethodHandle newArray = MethodHandleImpl.varargsArray(arrayType, arrayLength);
LambdaForm lform = mh.editor().collectArgumentArrayForm(1 + collectArgPos, newArray);
if (lform != null) {
return mh.copyWith(resultType, lform);
}
lform = mh.editor().collectArgumentsForm(1 + collectArgPos, newArray.type().basicType());
return mh.copyWithExtendL(resultType, lform, newArray);
- } else {
- MethodHandle target = this;
- if (arrayType != type().parameterType(collectArgPos))
- target = MethodHandleImpl.makePairwiseConvert(this, type().changeParameterType(collectArgPos, arrayType), true);
- MethodHandle collector = MethodHandleImpl.varargsArray(arrayType, arrayLength);
- return MethodHandles.collectArguments(target, collectArgPos, collector);
- }
}
/**
* See if {@code asCollector} can be validly called with the given arguments.
* Return false if the last parameter is not an exact match to arrayType.
--- 990,1008 ----
src/java.base/share/classes/java/lang/invoke/MethodHandle.java
Index
Unified diffs
Context diffs
Sdiffs
Patch
New
Old
Previous File
Next File