nashorn/src/jdk/nashorn/internal/objects/PrototypeObject.java
changeset 18610 9a052996a7b7
parent 16277 fd698c5ee684
child 18618 136279c4cbe6
equal deleted inserted replaced
18608:cb5ba414975f 18610:9a052996a7b7
    33 import jdk.nashorn.internal.runtime.Property;
    33 import jdk.nashorn.internal.runtime.Property;
    34 import jdk.nashorn.internal.runtime.PropertyMap;
    34 import jdk.nashorn.internal.runtime.PropertyMap;
    35 import jdk.nashorn.internal.runtime.ScriptFunction;
    35 import jdk.nashorn.internal.runtime.ScriptFunction;
    36 import jdk.nashorn.internal.runtime.ScriptObject;
    36 import jdk.nashorn.internal.runtime.ScriptObject;
    37 import jdk.nashorn.internal.lookup.Lookup;
    37 import jdk.nashorn.internal.lookup.Lookup;
       
    38 import jdk.nashorn.internal.lookup.MethodHandleFactory;
    38 
    39 
    39 /**
    40 /**
    40  * Instances of this class serve as "prototype" object for script functions.
    41  * Instances of this class serve as "prototype" object for script functions.
    41  * The purpose is to expose "constructor" property from "prototype". Also, nasgen
    42  * The purpose is to expose "constructor" property from "prototype". Also, nasgen
    42  * generated prototype classes extend from this class.
    43  * generated prototype classes extend from this class.
   104     private void setConstructor(final Object constructor) {
   105     private void setConstructor(final Object constructor) {
   105         this.constructor = constructor;
   106         this.constructor = constructor;
   106     }
   107     }
   107 
   108 
   108     private static MethodHandle findOwnMH(final String name, final Class<?> rtype, final Class<?>... types) {
   109     private static MethodHandle findOwnMH(final String name, final Class<?> rtype, final Class<?>... types) {
   109         return MH.findStatic(MethodHandles.publicLookup(), PrototypeObject.class, name, MH.type(rtype, types));
   110         try {
       
   111             return MethodHandles.lookup().findStatic(PrototypeObject.class, name, MH.type(rtype, types));
       
   112         } catch (final NoSuchMethodException | IllegalAccessException e) {
       
   113             throw new MethodHandleFactory.LookupException(e);
       
   114         }
   110     }
   115     }
   111 }
   116 }