Java Code Examples for jdk.nashorn.internal.runtime.linker.Bootstrap#isDynamicMethod()
The following examples show how to use
jdk.nashorn.internal.runtime.linker.Bootstrap#isDynamicMethod() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: IteratorAction.java From openjdk-8-source with GNU General Public License v2.0 | 5 votes |
/** * Apply action main loop. * @return result of apply */ public final T apply() { final boolean strict; if (callbackfn instanceof ScriptFunction) { strict = ((ScriptFunction)callbackfn).isStrict(); } else if (callbackfn instanceof JSObject && ((JSObject)callbackfn).isFunction()) { strict = ((JSObject)callbackfn).isStrictFunction(); } else if (Bootstrap.isDynamicMethod(callbackfn) || Bootstrap.isFunctionalInterfaceObject(callbackfn)) { strict = false; } else { throw typeError("not.a.function", ScriptRuntime.safeToString(callbackfn)); } // for non-strict callback, need to translate undefined thisArg to be global object thisArg = (thisArg == ScriptRuntime.UNDEFINED && !strict)? Context.getGlobal() : thisArg; applyLoopBegin(iter); final boolean reverse = iter.isReverse(); while (iter.hasNext()) { final Object val = iter.next(); index = iter.nextIndex() + (reverse ? 1 : -1); try { if (!forEach(val, index)) { return result; } } catch (final RuntimeException | Error e) { throw e; } catch (final Throwable t) { throw new RuntimeException(t); } } return result; }
Example 2
Source File: IteratorAction.java From openjdk-8 with GNU General Public License v2.0 | 5 votes |
/** * Apply action main loop. * @return result of apply */ public final T apply() { final boolean strict; if (callbackfn instanceof ScriptFunction) { strict = ((ScriptFunction)callbackfn).isStrict(); } else if (callbackfn instanceof JSObject && ((JSObject)callbackfn).isFunction()) { strict = ((JSObject)callbackfn).isStrictFunction(); } else if (Bootstrap.isDynamicMethod(callbackfn) || Bootstrap.isFunctionalInterfaceObject(callbackfn)) { strict = false; } else { throw typeError("not.a.function", ScriptRuntime.safeToString(callbackfn)); } // for non-strict callback, need to translate undefined thisArg to be global object thisArg = (thisArg == ScriptRuntime.UNDEFINED && !strict)? Context.getGlobal() : thisArg; applyLoopBegin(iter); final boolean reverse = iter.isReverse(); while (iter.hasNext()) { final Object val = iter.next(); index = iter.nextIndex() + (reverse ? 1 : -1); try { if (!forEach(val, index)) { return result; } } catch (final RuntimeException | Error e) { throw e; } catch (final Throwable t) { throw new RuntimeException(t); } } return result; }
Example 3
Source File: IteratorAction.java From nashorn with GNU General Public License v2.0 | 5 votes |
/** * Apply action main loop. * @return result of apply */ public final T apply() { final boolean strict; if (callbackfn instanceof ScriptFunction) { strict = ((ScriptFunction)callbackfn).isStrict(); } else if (callbackfn instanceof JSObject && ((JSObject)callbackfn).isFunction()) { strict = ((JSObject)callbackfn).isStrictFunction(); } else if (Bootstrap.isDynamicMethod(callbackfn) || Bootstrap.isFunctionalInterfaceObject(callbackfn)) { strict = false; } else { throw typeError("not.a.function", ScriptRuntime.safeToString(callbackfn)); } // for non-strict callback, need to translate undefined thisArg to be global object thisArg = (thisArg == ScriptRuntime.UNDEFINED && !strict)? Context.getGlobal() : thisArg; applyLoopBegin(iter); final boolean reverse = iter.isReverse(); while (iter.hasNext()) { final Object val = iter.next(); index = iter.nextIndex() + (reverse ? 1 : -1); try { if (!forEach(val, index)) { return result; } } catch (final RuntimeException | Error e) { throw e; } catch (final Throwable t) { throw new RuntimeException(t); } } return result; }
Example 4
Source File: NativeJava.java From TencentKona-8 with GNU General Public License v2.0 | 2 votes |
/** * Returns true if the specified object is a Java method. * @param self not used * @param obj the object that is checked if it is a Java method object or not * @return tells whether given object is a Java method object or not. */ @Function(attributes = Attribute.NOT_ENUMERABLE, where = Where.CONSTRUCTOR) public static boolean isJavaMethod(final Object self, final Object obj) { return Bootstrap.isDynamicMethod(obj); }
Example 5
Source File: NativeJava.java From jdk8u60 with GNU General Public License v2.0 | 2 votes |
/** * Returns true if the specified object is a Java method. * @param self not used * @param obj the object that is checked if it is a Java method object or not * @return tells whether given object is a Java method object or not. */ @Function(attributes = Attribute.NOT_ENUMERABLE, where = Where.CONSTRUCTOR) public static boolean isJavaMethod(final Object self, final Object obj) { return Bootstrap.isDynamicMethod(obj); }
Example 6
Source File: NativeJava.java From openjdk-jdk8u with GNU General Public License v2.0 | 2 votes |
/** * Returns true if the specified object is a Java method. * @param self not used * @param obj the object that is checked if it is a Java method object or not * @return tells whether given object is a Java method object or not. */ @Function(attributes = Attribute.NOT_ENUMERABLE, where = Where.CONSTRUCTOR) public static boolean isJavaMethod(final Object self, final Object obj) { return Bootstrap.isDynamicMethod(obj); }
Example 7
Source File: NativeJava.java From openjdk-jdk8u-backup with GNU General Public License v2.0 | 2 votes |
/** * Returns true if the specified object is a Java method. * @param self not used * @param obj the object that is checked if it is a Java method object or not * @return tells whether given object is a Java method object or not. */ @Function(attributes = Attribute.NOT_ENUMERABLE, where = Where.CONSTRUCTOR) public static boolean isJavaMethod(final Object self, final Object obj) { return Bootstrap.isDynamicMethod(obj); }
Example 8
Source File: NativeJava.java From openjdk-jdk9 with GNU General Public License v2.0 | 2 votes |
/** * Returns true if the specified object is a Java method. * @param self not used * @param obj the object that is checked if it is a Java method object or not * @return tells whether given object is a Java method object or not. */ @Function(attributes = Attribute.NOT_ENUMERABLE, where = Where.CONSTRUCTOR) public static boolean isJavaMethod(final Object self, final Object obj) { return Bootstrap.isDynamicMethod(obj); }
Example 9
Source File: NativeJava.java From hottub with GNU General Public License v2.0 | 2 votes |
/** * Returns true if the specified object is a Java method. * @param self not used * @param obj the object that is checked if it is a Java method object or not * @return tells whether given object is a Java method object or not. */ @Function(attributes = Attribute.NOT_ENUMERABLE, where = Where.CONSTRUCTOR) public static boolean isJavaMethod(final Object self, final Object obj) { return Bootstrap.isDynamicMethod(obj); }
Example 10
Source File: NativeJava.java From jdk8u_nashorn with GNU General Public License v2.0 | 2 votes |
/** * Returns true if the specified object is a Java method. * @param self not used * @param obj the object that is checked if it is a Java method object or not * @return tells whether given object is a Java method object or not. */ @Function(attributes = Attribute.NOT_ENUMERABLE, where = Where.CONSTRUCTOR) public static boolean isJavaMethod(final Object self, final Object obj) { return Bootstrap.isDynamicMethod(obj); }