Categories:
Audio (13)
Biotech (29)
Bytecode (36)
Database (77)
Framework (7)
Game (7)
General (507)
Graphics (53)
I/O (35)
IDE (2)
JAR Tools (102)
JavaBeans (21)
JDBC (121)
JDK (426)
JSP (20)
Logging (108)
Mail (58)
Messaging (8)
Network (84)
PDF (97)
Report (7)
Scripting (84)
Security (32)
Server (121)
Servlet (26)
SOAP (24)
Testing (54)
Web (15)
XML (322)
Collections:
Other Resources:
JDK 11 jdk.scripting.nashorn.jmod - Scripting Nashorn Module
JDK 11 jdk.scripting.nashorn.jmod is the JMOD file for JDK 11 Scripting Nashorn module.
JDK 11 Scripting Nashorn module compiled class files are stored in \fyicenter\jdk-11.0.1\jmods\jdk.scripting.nashorn.jmod.
JDK 11 Scripting Nashorn module compiled class files are also linked and stored in the \fyicenter\jdk-11.0.1\lib\modules JImage file.
JDK 11 Scripting Nashorn module source code files are stored in \fyicenter\jdk-11.0.1\lib\src.zip\jdk.scripting.nashorn.
You can click and view the content of each source code file in the list below.
✍: FYIcenter
⏎ jdk/nashorn/internal/runtime/Undefined.java
/*
* Copyright (c) 2010, 2013, Oracle and/or its affiliates. All rights reserved.
* ORACLE PROPRIETARY/CONFIDENTIAL. Use is subject to license terms.
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*/
package jdk.nashorn.internal.runtime;
import static jdk.nashorn.internal.lookup.Lookup.MH;
import static jdk.nashorn.internal.runtime.ECMAErrors.typeError;
import java.lang.invoke.MethodHandle;
import java.lang.invoke.MethodHandles;
import jdk.dynalink.CallSiteDescriptor;
import jdk.dynalink.NamedOperation;
import jdk.dynalink.linker.GuardedInvocation;
import jdk.dynalink.linker.support.Guards;
import jdk.nashorn.internal.runtime.linker.NashornCallSiteDescriptor;
/**
* Unique instance of this class is used to represent JavaScript undefined.
*/
public final class Undefined extends DefaultPropertyAccess {
private Undefined() {
}
private static final Undefined UNDEFINED = new Undefined();
private static final Undefined EMPTY = new Undefined();
// Guard used for indexed property access/set on the Undefined instance
private static final MethodHandle UNDEFINED_GUARD = Guards.getIdentityGuard(UNDEFINED);
/**
* Get the value of {@code undefined}, this is represented as a global singleton
* instance of this class. It can always be reference compared
*
* @return the undefined object
*/
public static Undefined getUndefined() {
return UNDEFINED;
}
/**
* Get the value of {@code empty}. This is represented as a global singleton
* instanceof this class. It can always be reference compared.
* <p>
* We need empty to differentiate behavior in things like array iterators
* <p>
* @return the empty object
*/
public static Undefined getEmpty() {
return EMPTY;
}
/**
* Get the class name of Undefined
* @return "Undefined"
*/
@SuppressWarnings("static-method")
public String getClassName() {
return "Undefined";
}
@Override
public String toString() {
return "undefined";
}
/**
* Lookup the appropriate method for an invoke dynamic call.
* @param desc The invoke dynamic callsite descriptor.
* @return GuardedInvocation to be invoked at call site.
*/
public static GuardedInvocation lookup(final CallSiteDescriptor desc) {
switch (NashornCallSiteDescriptor.getStandardOperation(desc)) {
case CALL:
case NEW:
final String name = NashornCallSiteDescriptor.getOperand(desc);
final String msg = name != null? "not.a.function" : "cant.call.undefined";
throw typeError(msg, name);
case GET:
// NOTE: we support GET:ELEMENT and SET:ELEMENT as JavaScript doesn't distinguish items from properties. Nashorn itself
// emits "GET:PROPERTY|ELEMENT|METHOD:identifier" for "<expr>.<identifier>" and "GET:ELEMENT|PROPERTY|METHOD" for "<expr>[<expr>]", but we are
// more flexible here and dispatch not on operation name (getProp vs. getElem), but rather on whether the
// operation has an associated name or not.
if (!(desc.getOperation() instanceof NamedOperation)) {
return findGetIndexMethod(desc);
}
return findGetMethod(desc);
case SET:
if (!(desc.getOperation() instanceof NamedOperation)) {
return findSetIndexMethod(desc);
}
return findSetMethod(desc);
case REMOVE:
if (!(desc.getOperation() instanceof NamedOperation)) {
return findDeleteIndexMethod(desc);
}
return findDeleteMethod(desc);
default:
}
return null;
}
private static ECMAException lookupTypeError(final String msg, final CallSiteDescriptor desc) {
final String name = NashornCallSiteDescriptor.getOperand(desc);
return typeError(msg, name != null && !name.isEmpty()? name : null);
}
private static final MethodHandle GET_METHOD = findOwnMH("get", Object.class, Object.class);
private static final MethodHandle SET_METHOD = MH.insertArguments(findOwnMH("set", void.class, Object.class, Object.class, int.class), 3, NashornCallSiteDescriptor.CALLSITE_STRICT);
private static final MethodHandle DELETE_METHOD = MH.insertArguments(findOwnMH("delete", boolean.class, Object.class, boolean.class), 2, false);
private static GuardedInvocation findGetMethod(final CallSiteDescriptor desc) {
return new GuardedInvocation(MH.insertArguments(GET_METHOD, 1, NashornCallSiteDescriptor.getOperand(desc)), UNDEFINED_GUARD).asType(desc);
}
private static GuardedInvocation findGetIndexMethod(final CallSiteDescriptor desc) {
return new GuardedInvocation(GET_METHOD, UNDEFINED_GUARD).asType(desc);
}
private static GuardedInvocation findSetMethod(final CallSiteDescriptor desc) {
return new GuardedInvocation(MH.insertArguments(SET_METHOD, 1, NashornCallSiteDescriptor.getOperand(desc)), UNDEFINED_GUARD).asType(desc);
}
private static GuardedInvocation findSetIndexMethod(final CallSiteDescriptor desc) {
return new GuardedInvocation(SET_METHOD, UNDEFINED_GUARD).asType(desc);
}
private static GuardedInvocation findDeleteMethod(final CallSiteDescriptor desc) {
return new GuardedInvocation(MH.insertArguments(DELETE_METHOD, 1, NashornCallSiteDescriptor.getOperand(desc)), UNDEFINED_GUARD).asType(desc);
}
private static GuardedInvocation findDeleteIndexMethod(final CallSiteDescriptor desc) {
return new GuardedInvocation(DELETE_METHOD, UNDEFINED_GUARD).asType(desc);
}
@Override
public Object get(final Object key) {
throw typeError("cant.read.property.of.undefined", ScriptRuntime.safeToString(key));
}
@Override
public void set(final Object key, final Object value, final int flags) {
throw typeError("cant.set.property.of.undefined", ScriptRuntime.safeToString(key));
}
@Override
public boolean delete(final Object key, final boolean strict) {
throw typeError("cant.delete.property.of.undefined", ScriptRuntime.safeToString(key));
}
@Override
public boolean has(final Object key) {
return false;
}
@Override
public boolean hasOwnProperty(final Object key) {
return false;
}
private static MethodHandle findOwnMH(final String name, final Class<?> rtype, final Class<?>... types) {
return MH.findVirtual(MethodHandles.lookup(), Undefined.class, name, MH.type(rtype, types));
}
}
⏎ jdk/nashorn/internal/runtime/Undefined.java
Or download all of them as a single archive file:
File name: jdk.scripting.nashorn-11.0.1-src.zip File size: 1390965 bytes Release date: 2018-11-04 Download
⇒ JDK 11 jdk.scripting.nashorn.shell.jmod - Scripting Nashorn Shell Module
2020-04-25, ≈225🔥, 0💬
Popular Posts:
maven-core-3.5.4.jar is the JAR file for Apache Maven 3.5.4 Core module. Apache Maven is a software ...
Smack is an Open Source XMPP (Jabber) client library for instant messaging and presence. A pure Java...
The JMX technology provides the tools for building distributed, Web-based, modular and dynamic solut...
What Is log4j-1.2.15.jar? I got the JAR file from apache-log4j-1.2.15.zip. log4j-1.2.15.jar is the v...
How to download and install ojdbc6.jar for Oracle 11g R2? ojdbc6.jar for Oracle 11g R2 is a Java 6, ...