Mercurial > people > rkennke > jdk9-shenandoah-final > nashorn
changeset 371:8e03121cc286
8017260: adjust lookup code in objects.* classes
Reviewed-by: hannesw, jlaskey
author | sundar |
---|---|
date | Fri, 21 Jun 2013 16:55:18 +0530 |
parents | ac404bf3f8c8 |
children | b4e2bccf9598 c30beaf3c42a |
files | src/jdk/nashorn/internal/objects/Global.java src/jdk/nashorn/internal/objects/NativeArguments.java src/jdk/nashorn/internal/objects/NativeError.java src/jdk/nashorn/internal/objects/NativeStrictArguments.java src/jdk/nashorn/internal/objects/PrototypeObject.java |
diffstat | 5 files changed, 32 insertions(+), 7 deletions(-) [+] |
line wrap: on
line diff
--- a/src/jdk/nashorn/internal/objects/Global.java Thu Jun 20 13:45:38 2013 +0530 +++ b/src/jdk/nashorn/internal/objects/Global.java Fri Jun 21 16:55:18 2013 +0530 @@ -25,9 +25,9 @@ package jdk.nashorn.internal.objects; +import static jdk.nashorn.internal.lookup.Lookup.MH; import static jdk.nashorn.internal.runtime.ECMAErrors.typeError; import static jdk.nashorn.internal.runtime.ScriptRuntime.UNDEFINED; -import static jdk.nashorn.internal.lookup.Lookup.MH; import java.io.IOException; import java.io.PrintWriter; @@ -43,6 +43,7 @@ import java.util.Map; import jdk.internal.dynalink.linker.GuardedInvocation; import jdk.internal.dynalink.linker.LinkRequest; +import jdk.nashorn.internal.lookup.MethodHandleFactory; import jdk.nashorn.internal.objects.annotations.Attribute; import jdk.nashorn.internal.objects.annotations.Property; import jdk.nashorn.internal.objects.annotations.ScriptClass; @@ -1780,7 +1781,11 @@ private static MethodHandle findOwnMH(final String name, final Class<?> rtype, final Class<?>... types) { - return MH.findStatic(MethodHandles.publicLookup(), Global.class, name, MH.type(rtype, types)); + try { + return MethodHandles.lookup().findStatic(Global.class, name, MH.type(rtype, types)); + } catch (final NoSuchMethodException | IllegalAccessException e) { + throw new MethodHandleFactory.LookupException(e); + } } RegExpResult getLastRegExpResult() {
--- a/src/jdk/nashorn/internal/objects/NativeArguments.java Thu Jun 20 13:45:38 2013 +0530 +++ b/src/jdk/nashorn/internal/objects/NativeArguments.java Fri Jun 21 16:55:18 2013 +0530 @@ -25,9 +25,9 @@ package jdk.nashorn.internal.objects; +import static jdk.nashorn.internal.lookup.Lookup.MH; import static jdk.nashorn.internal.runtime.ECMAErrors.typeError; import static jdk.nashorn.internal.runtime.ScriptRuntime.UNDEFINED; -import static jdk.nashorn.internal.lookup.Lookup.MH; import java.lang.invoke.MethodHandle; import java.lang.invoke.MethodHandles; @@ -42,6 +42,7 @@ import jdk.nashorn.internal.runtime.arrays.ArrayData; import jdk.nashorn.internal.runtime.arrays.ArrayIndex; import jdk.nashorn.internal.lookup.Lookup; +import jdk.nashorn.internal.lookup.MethodHandleFactory; /** * ECMA 10.6 Arguments Object. @@ -624,7 +625,11 @@ } private static MethodHandle findOwnMH(final String name, final Class<?> rtype, final Class<?>... types) { - return MH.findStatic(MethodHandles.publicLookup(), NativeArguments.class, name, MH.type(rtype, types)); + try { + return MethodHandles.lookup().findStatic(NativeArguments.class, name, MH.type(rtype, types)); + } catch (final NoSuchMethodException | IllegalAccessException e) { + throw new MethodHandleFactory.LookupException(e); + } } }
--- a/src/jdk/nashorn/internal/objects/NativeError.java Thu Jun 20 13:45:38 2013 +0530 +++ b/src/jdk/nashorn/internal/objects/NativeError.java Fri Jun 21 16:55:18 2013 +0530 @@ -33,6 +33,7 @@ import java.util.ArrayList; import java.util.List; import jdk.nashorn.internal.codegen.CompilerConstants; +import jdk.nashorn.internal.lookup.MethodHandleFactory; import jdk.nashorn.internal.objects.annotations.Attribute; import jdk.nashorn.internal.objects.annotations.Constructor; import jdk.nashorn.internal.objects.annotations.Function; @@ -328,6 +329,10 @@ } private static MethodHandle findOwnMH(final String name, final Class<?> rtype, final Class<?>... types) { - return MH.findStatic(MethodHandles.publicLookup(), NativeError.class, name, MH.type(rtype, types)); + try { + return MethodHandles.lookup().findStatic(NativeError.class, name, MH.type(rtype, types)); + } catch (final NoSuchMethodException | IllegalAccessException e) { + throw new MethodHandleFactory.LookupException(e); + } } }
--- a/src/jdk/nashorn/internal/objects/NativeStrictArguments.java Thu Jun 20 13:45:38 2013 +0530 +++ b/src/jdk/nashorn/internal/objects/NativeStrictArguments.java Fri Jun 21 16:55:18 2013 +0530 @@ -37,6 +37,7 @@ import jdk.nashorn.internal.runtime.ScriptObject; import jdk.nashorn.internal.runtime.arrays.ArrayData; import jdk.nashorn.internal.lookup.Lookup; +import jdk.nashorn.internal.lookup.MethodHandleFactory; /** * ECMA 10.6 Arguments Object. @@ -142,6 +143,10 @@ } private static MethodHandle findOwnMH(final String name, final Class<?> rtype, final Class<?>... types) { - return MH.findStatic(MethodHandles.publicLookup(), NativeStrictArguments.class, name, MH.type(rtype, types)); + try { + return MethodHandles.lookup().findStatic(NativeStrictArguments.class, name, MH.type(rtype, types)); + } catch (final NoSuchMethodException | IllegalAccessException e) { + throw new MethodHandleFactory.LookupException(e); + } } }
--- a/src/jdk/nashorn/internal/objects/PrototypeObject.java Thu Jun 20 13:45:38 2013 +0530 +++ b/src/jdk/nashorn/internal/objects/PrototypeObject.java Fri Jun 21 16:55:18 2013 +0530 @@ -35,6 +35,7 @@ import jdk.nashorn.internal.runtime.ScriptFunction; import jdk.nashorn.internal.runtime.ScriptObject; import jdk.nashorn.internal.lookup.Lookup; +import jdk.nashorn.internal.lookup.MethodHandleFactory; /** * Instances of this class serve as "prototype" object for script functions. @@ -106,6 +107,10 @@ } private static MethodHandle findOwnMH(final String name, final Class<?> rtype, final Class<?>... types) { - return MH.findStatic(MethodHandles.publicLookup(), PrototypeObject.class, name, MH.type(rtype, types)); + try { + return MethodHandles.lookup().findStatic(PrototypeObject.class, name, MH.type(rtype, types)); + } catch (final NoSuchMethodException | IllegalAccessException e) { + throw new MethodHandleFactory.LookupException(e); + } } }