Пример #1
0
 /**
  * Returns the Nashorn's internally used dynamic linker's services object. Note that in code that
  * is processing a linking request, you will normally use the {@code LinkerServices} object passed
  * by whatever top-level linker invoked the linking (if the call site is in Nashorn-generated
  * code, you'll get this object anyway). You should only resort to retrieving a linker services
  * object using this method when you need some linker services (e.g. type converter method
  * handles) outside of a code path that is linking a call site.
  *
  * @return Nashorn's internal dynamic linker's services object.
  */
 public static LinkerServices getLinkerServices() {
   return dynamicLinker.getLinkerServices();
 }
Пример #2
0
 /**
  * Create a call site and link it for Nashorn. This version of the method conforms to the
  * invokedynamic bootstrap method expected signature and is referenced from Nashorn generated
  * bytecode as the bootstrap method for all invokedynamic instructions.
  *
  * @param lookup MethodHandle lookup. Ignored as Nashorn only uses public lookup.
  * @param opDesc Dynalink dynamic operation descriptor.
  * @param type Method type.
  * @param flags flags for call type, trace/profile etc.
  * @return CallSite with MethodHandle to appropriate method or null if not found.
  */
 public static CallSite bootstrap(
     final Lookup lookup, final String opDesc, final MethodType type, final int flags) {
   return dynamicLinker.link(LinkerCallSite.newLinkerCallSite(lookup, opDesc, type, flags));
 }