8017260: adjust lookup code in objects.* classes
Reviewed-by: hannesw, jlaskey
This commit is contained in:
parent
9e05183200
commit
6f8f3be8c3
@ -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.List;
|
||||
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 @@ public final class Global extends ScriptObject implements GlobalObject, Scope {
|
||||
|
||||
|
||||
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() {
|
||||
|
@ -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.ScriptRuntime;
|
||||
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 @@ public final class NativeArguments extends ScriptObject {
|
||||
}
|
||||
|
||||
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);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -33,6 +33,7 @@ import java.lang.invoke.MethodHandles;
|
||||
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 @@ public final class NativeError extends ScriptObject {
|
||||
}
|
||||
|
||||
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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -37,6 +37,7 @@ import jdk.nashorn.internal.runtime.ScriptFunction;
|
||||
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 @@ public final class NativeStrictArguments extends ScriptObject {
|
||||
}
|
||||
|
||||
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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -35,6 +35,7 @@ import jdk.nashorn.internal.runtime.PropertyMap;
|
||||
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 @@ public class PrototypeObject extends ScriptObject {
|
||||
}
|
||||
|
||||
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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user