Categories:
Audio (13)
Biotech (29)
Bytecode (36)
Database (77)
Framework (7)
Game (7)
General (507)
Graphics (53)
I/O (35)
IDE (2)
JAR Tools (101)
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 (309)
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/linker/JavaAdapterClassLoader.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.linker; import java.lang.reflect.InvocationTargetException; import java.lang.reflect.Method; import java.security.AccessControlContext; import java.security.AccessController; import java.security.PrivilegedAction; import java.security.ProtectionDomain; import java.security.SecureClassLoader; import java.util.Arrays; import java.util.Collection; import java.util.Collections; import java.util.HashSet; import java.util.Set; import jdk.dynalink.beans.StaticClass; import jdk.nashorn.internal.codegen.DumpBytecode; import jdk.nashorn.internal.runtime.Context; import jdk.nashorn.internal.runtime.JSType; import jdk.nashorn.internal.runtime.ScriptFunction; import jdk.nashorn.internal.runtime.ScriptObject; /** * This class encapsulates the bytecode of the adapter class and can be used to load it into the JVM as an actual Class. * It can be invoked repeatedly to create multiple adapter classes from the same bytecode; adapter classes that have * class-level overrides must be re-created for every set of such overrides. Note that while this class is named * "class loader", it does not, in fact, extend {@code ClassLoader}, but rather uses them internally. Instances of this * class are normally created by {@code JavaAdapterBytecodeGenerator}. */ final class JavaAdapterClassLoader { private static final Module NASHORN_MODULE = Context.class.getModule(); private static final AccessControlContext CREATE_LOADER_ACC_CTXT = ClassAndLoader.createPermAccCtxt("createClassLoader"); private static final AccessControlContext GET_CONTEXT_ACC_CTXT = ClassAndLoader.createPermAccCtxt(Context.NASHORN_GET_CONTEXT); private static final Collection<String> VISIBLE_INTERNAL_CLASS_NAMES = Collections.unmodifiableCollection(new HashSet<>( Arrays.asList(JavaAdapterServices.class.getName(), ScriptObject.class.getName(), ScriptFunction.class.getName(), JSType.class.getName()))); private final String className; private final byte[] classBytes; JavaAdapterClassLoader(final String className, final byte[] classBytes) { this.className = className.replace('/', '.'); this.classBytes = classBytes; } /** * Loads the generated adapter class into the JVM. * @param parentLoader the parent class loader for the generated class loader * @param protectionDomain the protection domain for the generated class * @return the generated adapter class */ StaticClass generateClass(final ClassLoader parentLoader, final ProtectionDomain protectionDomain) { assert protectionDomain != null; return AccessController.doPrivileged(new PrivilegedAction<StaticClass>() { @Override public StaticClass run() { try { return StaticClass.forClass(Class.forName(className, true, createClassLoader(parentLoader, protectionDomain))); } catch (final ClassNotFoundException e) { throw new AssertionError(e); // cannot happen } } }, CREATE_LOADER_ACC_CTXT); } // Note that the adapter class is created in the protection domain of the class/interface being // extended/implemented, and only the privileged global setter action class is generated in the protection domain // of Nashorn itself. Also note that the creation and loading of the global setter is deferred until it is // required by JVM linker, which will only happen on first invocation of any of the adapted method. We could defer // it even more by separating its invocation into a separate static method on the adapter class, but then someone // with ability to introspect on the class and use setAccessible(true) on it could invoke the method. It's a // security tradeoff... private ClassLoader createClassLoader(final ClassLoader parentLoader, final ProtectionDomain protectionDomain) { return new SecureClassLoader(parentLoader) { private final ClassLoader myLoader = getClass().getClassLoader(); // the unnamed module into which adapter is loaded! private final Module adapterModule = getUnnamedModule(); { // specific exports from nashorn to the new adapter module NASHORN_MODULE.addExports("jdk.nashorn.internal.runtime", adapterModule); NASHORN_MODULE.addExports("jdk.nashorn.internal.runtime.linker", adapterModule); // nashorn should be be able to read methods of classes loaded in adapter module NASHORN_MODULE.addReads(adapterModule); } @Override public Class<?> loadClass(final String name, final boolean resolve) throws ClassNotFoundException { try { final int i = name.lastIndexOf('.'); if(i != -1){ final String pkgName = name.substring(0,i); Context.checkPackageAccess(pkgName); } return super.loadClass(name, resolve); } catch (final SecurityException se) { // we may be implementing an interface or extending a class that was // loaded by a loader that prevents package.access. If so, it'd throw // SecurityException for nashorn's classes!. For adapter's to work, we // should be able to refer to the few classes it needs in its implementation. if(VISIBLE_INTERNAL_CLASS_NAMES.contains(name)) { return myLoader != null? myLoader.loadClass(name) : Class.forName(name, false, myLoader); } throw se; } } @Override protected Class<?> findClass(final String name) throws ClassNotFoundException { if(name.equals(className)) { assert classBytes != null : "what? already cleared .class bytes!!"; final Context ctx = AccessController.doPrivileged(new PrivilegedAction<Context>() { @Override public Context run() { return Context.getContext(); } }, GET_CONTEXT_ACC_CTXT); DumpBytecode.dumpBytecode(ctx.getEnv(), ctx.getLogger(jdk.nashorn.internal.codegen.Compiler.class), classBytes, name); return defineClass(name, classBytes, 0, classBytes.length, protectionDomain); } throw new ClassNotFoundException(name); } }; } }
⏎ jdk/nashorn/internal/runtime/linker/JavaAdapterClassLoader.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, 107330👍, 0💬
Popular Posts:
What Is jaxb-api-2.1.6.jar? Java Architecture for XML Binding (JAXB) is a Java API that allows Java ...
What Is commons-lang3-3.1.jar? commons-lang3-3.1.jar is the JAR file for Apache Commons Lang 3.1, wh...
JDK 11 jdk.jdi.jmod is the JMOD file for JDK 11 JDI (Java Debug Interface) tool. JDK 11 JDI tool com...
iText is an ideal library for developers looking to enhance web- and other applications with dynamic...
JDK 11 jdk.httpserver.jmod is the JMOD file for JDK 11 HTTP Server module. JDK 11 HTTP Server module...