nashorn/src/jdk/nashorn/internal/runtime/linker/JavaAdapterFactory.java
changeset 24719 f726e9d67629
parent 22669 75563515567f
child 24720 75f8388b79df
equal deleted inserted replaced
23083:8c74590d5df1 24719:f726e9d67629
   162      */
   162      */
   163     public static MethodHandle getConstructor(final Class<?> sourceType, final Class<?> targetType, final MethodHandles.Lookup lookup) throws Exception {
   163     public static MethodHandle getConstructor(final Class<?> sourceType, final Class<?> targetType, final MethodHandles.Lookup lookup) throws Exception {
   164         final StaticClass adapterClass = getAdapterClassFor(new Class<?>[] { targetType }, null, lookup);
   164         final StaticClass adapterClass = getAdapterClassFor(new Class<?>[] { targetType }, null, lookup);
   165         return MH.bindTo(Bootstrap.getLinkerServices().getGuardedInvocation(new LinkRequestImpl(
   165         return MH.bindTo(Bootstrap.getLinkerServices().getGuardedInvocation(new LinkRequestImpl(
   166                 NashornCallSiteDescriptor.get(lookup, "dyn:new",
   166                 NashornCallSiteDescriptor.get(lookup, "dyn:new",
   167                         MethodType.methodType(targetType, StaticClass.class, sourceType), 0), false,
   167                         MethodType.methodType(targetType, StaticClass.class, sourceType), 0), null, false,
   168                         adapterClass, null)).getInvocation(), adapterClass);
   168                         adapterClass, null)).getInvocation(), adapterClass);
   169     }
   169     }
   170 
   170 
   171     /**
   171     /**
   172      * Returns whether an instance of the specified class/interface can be generated from a ScriptFunction. Returns true
   172      * Returns whether an instance of the specified class/interface can be generated from a ScriptFunction. Returns true