equal
deleted
inserted
replaced
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 } |