SUGGESTED FIX
Each ad hoc adapter has its own constant pool, to give meaning to the bytecodes which must mention names. This constant pool should be pre-resolved, coming out of MethodHandleWalk. (MHW has all the live values it needs to do this.) In particular, calls to MH.invoke and MH.invokeExact need to be resolved to customized invokers, with their own "live" MethodTypes. Note that MethodTypes cannot in general be recovered from "flat" signature strings, unless the caller is in the correct class loader. In the case of an ad hoc adapter, the loader is the BCP loader, which cannot see types outside the BCP.
|