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 10591 : 8049555: Move varargsArray from sun.invoke.util package to java.lang.invoke
Reviewed-by: ?
rev 10592 : 8050052: Small cleanups in java.lang.invoke code
Reviewed-by: ?
rev 10593 : 8050053: Improve caching of different invokers
Reviewed-by: vlivanov, ?
Contributed-by: john.r.rose@oracle.com
rev 10594 : 8050166: Get rid of some package-private methods on arguments in j.l.i.MethodHandle
Reviewed-by: vlivanov, ?
Contributed-by: john.r.rose@oracle.com
rev 10595 : 8050173: Add j.l.i.MethodHandle.copyWith(MethodType, LambdaForm)
Reviewed-by: vlivanov, ?
Contributed-by: john.r.rose@oracle.com
*** 1313,1325 ****
}
throw member.makeAccessException("cannot make variable arity", null);
}
/*non-public*/
! MethodHandle viewAsType(MethodType newType) {
// No actual conversions, just a new view of the same method.
! return MethodHandleImpl.makePairwiseConvert(this, newType, 0);
}
// Decoding
/*non-public*/
--- 1313,1343 ----
}
throw member.makeAccessException("cannot make variable arity", null);
}
/*non-public*/
! MethodHandle viewAsType(MethodType newType, boolean strict) {
// No actual conversions, just a new view of the same method.
! // Note that this operation must not produce a DirectMethodHandle,
! // because retyped DMHs, like any transformed MHs,
! // cannot be cracked into MethodHandleInfo.
! assert viewAsTypeChecks(newType, strict);
! BoundMethodHandle mh = rebind();
! assert(!((MethodHandle)mh instanceof DirectMethodHandle));
! return mh.copyWith(newType, mh.form);
! }
!
! /*non-public*/
! boolean viewAsTypeChecks(MethodType newType, boolean strict) {
! if (strict) {
! assert(type().isViewableAs(newType, true))
! : Arrays.asList(this, newType);
! } else {
! assert(type().basicType().isViewableAs(newType.basicType(), true))
! : Arrays.asList(this, newType);
! }
! return true;
}
// Decoding
/*non-public*/
*** 1371,1380 ****
--- 1389,1401 ----
//// Method handle implementation methods.
//// Sub-classes can override these default implementations.
//// All these methods assume arguments are already validated.
/*non-public*/
+ abstract MethodHandle copyWith(MethodType mt, LambdaForm lf);
+
+ /*non-public*/
BoundMethodHandle rebind() {
// Bind 'this' into a new invoker, of the known class BMH.
MethodType type2 = type();
LambdaForm form2 = reinvokerForm(this);
// form2 = lambda (bmh, arg*) { thismh = bmh[0]; invokeBasic(thismh, arg*) }
src/java.base/share/classes/java/lang/invoke/MethodHandle.java
Index
Unified diffs
Context diffs
Sdiffs
Patch
New
Old
Previous File
Next File