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/NashornStaticClassLinker.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.invoke.MethodHandles; import java.lang.reflect.Modifier; import jdk.dynalink.CallSiteDescriptor; import jdk.dynalink.NamedOperation; import jdk.dynalink.StandardOperation; import jdk.dynalink.beans.BeansLinker; import jdk.dynalink.beans.StaticClass; import jdk.dynalink.linker.GuardedInvocation; import jdk.dynalink.linker.GuardingDynamicLinker; import jdk.dynalink.linker.LinkRequest; import jdk.dynalink.linker.LinkerServices; import jdk.dynalink.linker.TypeBasedGuardingDynamicLinker; import jdk.dynalink.linker.support.Guards; import jdk.nashorn.internal.runtime.Context; import jdk.nashorn.internal.runtime.ECMAErrors; /** * Internal linker for {@link StaticClass} objects, only ever used by Nashorn engine and not exposed to other engines. * It is used for extending the "new" operator on StaticClass in order to be able to instantiate interfaces and abstract * classes by passing a ScriptObject or ScriptFunction as their implementation, e.g.: * <pre> * var r = new Runnable() { run: function() { print("Hello World" } } * </pre> * or for SAM types, even just passing a function: * <pre> * var r = new Runnable(function() { print("Hello World" }) * </pre> */ final class NashornStaticClassLinker implements TypeBasedGuardingDynamicLinker { private final GuardingDynamicLinker staticClassLinker; NashornStaticClassLinker(final BeansLinker beansLinker) { this.staticClassLinker = beansLinker.getLinkerForClass(StaticClass.class); } @Override public boolean canLinkType(final Class<?> type) { return type == StaticClass.class; } @Override public GuardedInvocation getGuardedInvocation(final LinkRequest request, final LinkerServices linkerServices) throws Exception { final Object self = request.getReceiver(); if (self == null || self.getClass() != StaticClass.class) { return null; } final Class<?> receiverClass = ((StaticClass) self).getRepresentedClass(); Bootstrap.checkReflectionAccess(receiverClass, true); final CallSiteDescriptor desc = request.getCallSiteDescriptor(); // We intercept "new" on StaticClass instances to provide additional capabilities if (NamedOperation.getBaseOperation(desc.getOperation()) == StandardOperation.NEW) { if (! Modifier.isPublic(receiverClass.getModifiers())) { throw ECMAErrors.typeError("new.on.nonpublic.javatype", receiverClass.getName()); } // make sure new is on accessible Class Context.checkPackageAccess(receiverClass); // Is the class abstract? (This includes interfaces.) if (NashornLinker.isAbstractClass(receiverClass)) { // Change this link request into a link request on the adapter class. final Object[] args = request.getArguments(); final MethodHandles.Lookup lookup = NashornCallSiteDescriptor.getLookupInternal(request.getCallSiteDescriptor()); args[0] = JavaAdapterFactory.getAdapterClassFor(new Class<?>[] { receiverClass }, null, lookup); final LinkRequest adapterRequest = request.replaceArguments(request.getCallSiteDescriptor(), args); final GuardedInvocation gi = checkNullConstructor(delegate(linkerServices, adapterRequest), receiverClass); // Finally, modify the guard to test for the original abstract class. return gi.replaceMethods(gi.getInvocation(), Guards.getIdentityGuard(self)); } // If the class was not abstract, just delegate linking to the standard StaticClass linker. Make an // additional check to ensure we have a constructor. We could just fall through to the next "return" // statement, except we also insert a call to checkNullConstructor() which throws an ECMAScript TypeError // with a more intuitive message when no suitable constructor is found. return checkNullConstructor(delegate(linkerServices, request), receiverClass); } // In case this was not a "new" operation, just delegate to the the standard StaticClass linker. return delegate(linkerServices, request); } private GuardedInvocation delegate(final LinkerServices linkerServices, final LinkRequest request) throws Exception { return NashornBeansLinker.getGuardedInvocation(staticClassLinker, request, linkerServices); } private static GuardedInvocation checkNullConstructor(final GuardedInvocation ctorInvocation, final Class<?> receiverClass) { if(ctorInvocation == null) { throw ECMAErrors.typeError("no.constructor.matches.args", receiverClass.getName()); } return ctorInvocation; } }
⏎ jdk/nashorn/internal/runtime/linker/NashornStaticClassLinker.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, 83095👍, 0💬
Popular Posts:
How to read XML document with XML Schema validation from socket connections with the socket\DelayedI...
Commons Pool provides an Object-pooling API, with three major aspects: 1. A generic object pool inte...
How to run "jarsigner" command from JDK tools.jar file? "jarsigner" command allows you to digitally ...
What Is jaxb-impl-2.1.12.jar? Java Architecture for XML Binding (JAXB) is a Java API that allows Jav...
Jaxen, Release 1.1.1, is an open source XPath library written in Java. It is adaptable to many diffe...