On 5/5/20 3:12 PM, Claes Redestad wrote:
Hi,
in the current implementation MethodHandle.viewAsType eagerly rebinds
when creating a view of a method type as an alternative type:
MethodHandle viewAsType(MethodType newType, boolean strict) {
...
MethodHandle mh = rebind();
return this.copyWith(newType, mh.form);
}
This prevents exposing uncrackable DMHs, ie, ones where calling
Lookup.revealDirect(mh) would not produce a correct MethodHandleInfo.
If we restructure this so that crackability is a property on the DMH, we
can avoid the rebinds:
http://cr.openjdk.java.net/~redestad/8244413/open.00/
This looks good.
Nit: one assert with paratheses and the other without. Better to make
them consistent.
163 assert viewAsTypeChecks(newType, strict); 164
assert(this.getClass() == DirectMethodHandle.class); // must override in
subclasses
thanks
Mandy