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/ECMAErrors.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 java.text.MessageFormat; import java.util.Locale; import java.util.ResourceBundle; import jdk.nashorn.internal.codegen.CompilerConstants; import jdk.nashorn.internal.objects.Global; import jdk.nashorn.internal.scripts.JS; /** * Helper class to throw various standard "ECMA error" exceptions such as Error, ReferenceError, TypeError etc. */ public final class ECMAErrors { private static final String MESSAGES_RESOURCE = "jdk.nashorn.internal.runtime.resources.Messages"; private static final ResourceBundle MESSAGES_BUNDLE; static { MESSAGES_BUNDLE = ResourceBundle.getBundle(MESSAGES_RESOURCE, Locale.getDefault()); } /** We assume that compiler generates script classes into the known package. */ private static final String scriptPackage; static { final String name = JS.class.getName(); scriptPackage = name.substring(0, name.lastIndexOf('.')); } private ECMAErrors() { } private static ECMAException error(final Object thrown, final Throwable cause) { return new ECMAException(thrown, cause); } /** * Error dispatch mechanism. * Create a {@link ParserException} as the correct JavaScript error * * @param e {@code ParserException} for error dispatcher * * @return the resulting {@link ECMAException} */ public static ECMAException asEcmaException(final ParserException e) { return asEcmaException(Context.getGlobal(), e); } /** * Error dispatch mechanism. * Create a {@link ParserException} as the correct JavaScript error * * @param global global scope object * @param e {@code ParserException} for error dispatcher * * @return the resulting {@link ECMAException} */ public static ECMAException asEcmaException(final Global global, final ParserException e) { final JSErrorType errorType = e.getErrorType(); assert errorType != null : "error type for " + e + " was null"; final Global globalObj = global; final String msg = e.getMessage(); // translate to ECMAScript Error object using error type switch (errorType) { case ERROR: return error(globalObj.newError(msg), e); case EVAL_ERROR: return error(globalObj.newEvalError(msg), e); case RANGE_ERROR: return error(globalObj.newRangeError(msg), e); case REFERENCE_ERROR: return error(globalObj.newReferenceError(msg), e); case SYNTAX_ERROR: return error(globalObj.newSyntaxError(msg), e); case TYPE_ERROR: return error(globalObj.newTypeError(msg), e); case URI_ERROR: return error(globalObj.newURIError(msg), e); default: // should not happen - perhaps unknown error type? throw new AssertionError(e.getMessage()); } } /** * Create a syntax error (ECMA 15.11.6.4) * * @param msgId resource tag for error message * @param args arguments to resource * * @return the resulting {@link ECMAException} */ public static ECMAException syntaxError(final String msgId, final String... args) { return syntaxError(Context.getGlobal(), msgId, args); } /** * Create a syntax error (ECMA 15.11.6.4) * * @param global global scope object * @param msgId resource tag for error message * @param args arguments to resource * * @return the resulting {@link ECMAException} */ public static ECMAException syntaxError(final Global global, final String msgId, final String... args) { return syntaxError(global, null, msgId, args); } /** * Create a syntax error (ECMA 15.11.6.4) * * @param cause native Java {@code Throwable} that is the cause of error * @param msgId resource tag for error message * @param args arguments to resource * * @return the resulting {@link ECMAException} */ public static ECMAException syntaxError(final Throwable cause, final String msgId, final String... args) { return syntaxError(Context.getGlobal(), cause, msgId, args); } /** * Create a syntax error (ECMA 15.11.6.4) * * @param global global scope object * @param cause native Java {@code Throwable} that is the cause of error * @param msgId resource tag for error message * @param args arguments to resource * * @return the resulting {@link ECMAException} */ public static ECMAException syntaxError(final Global global, final Throwable cause, final String msgId, final String... args) { final String msg = getMessage("syntax.error." + msgId, args); return error(global.newSyntaxError(msg), cause); } /** * Create a type error (ECMA 15.11.6.5) * * @param msgId resource tag for error message * @param args arguments to resource * * @return the resulting {@link ECMAException} */ public static ECMAException typeError(final String msgId, final String... args) { return typeError(Context.getGlobal(), msgId, args); } /** * Create a type error (ECMA 15.11.6.5) * * @param global global scope object * @param msgId resource tag for error message * @param args arguments to resource * * @return the resulting {@link ECMAException} */ public static ECMAException typeError(final Global global, final String msgId, final String... args) { return typeError(global, null, msgId, args); } /** * Create a type error (ECMA 15.11.6.5) * * @param cause native Java {@code Throwable} that is the cause of error * @param msgId resource tag for error message * @param args arguments to resource * * @return the resulting {@link ECMAException} */ public static ECMAException typeError(final Throwable cause, final String msgId, final String... args) { return typeError(Context.getGlobal(), cause, msgId, args); } /** * Create a type error (ECMA 15.11.6.5) * * @param global global scope object * @param cause native Java {@code Throwable} that is the cause of error * @param msgId resource tag for error message * @param args arguments to resource * * @return the resulting {@link ECMAException} */ public static ECMAException typeError(final Global global, final Throwable cause, final String msgId, final String... args) { final String msg = getMessage("type.error." + msgId, args); return error(global.newTypeError(msg), cause); } /** * Create a range error (ECMA 15.11.6.2) * * @param msgId resource tag for error message * @param args arguments to resource * * @return the resulting {@link ECMAException} */ public static ECMAException rangeError(final String msgId, final String... args) { return rangeError(Context.getGlobal(), msgId, args); } /** * Create a range error (ECMA 15.11.6.2) * * @param global global scope object * @param msgId resource tag for error message * @param args arguments to resource * * @return the resulting {@link ECMAException} */ public static ECMAException rangeError(final Global global, final String msgId, final String... args) { return rangeError(global, null, msgId, args); } /** * Create a range error (ECMA 15.11.6.2) * * @param cause native Java {@code Throwable} that is the cause of error * @param msgId resource tag for error message * @param args arguments to resource * * @return the resulting {@link ECMAException} */ public static ECMAException rangeError(final Throwable cause, final String msgId, final String... args) { return rangeError(Context.getGlobal(), cause, msgId, args); } /** * Create a range error (ECMA 15.11.6.2) * * @param global global scope object * @param cause native Java {@code Throwable} that is the cause of error * @param msgId resource tag for error message * @param args arguments to resource * * @return the resulting {@link ECMAException} */ public static ECMAException rangeError(final Global global, final Throwable cause, final String msgId, final String... args) { final String msg = getMessage("range.error." + msgId, args); return error(global.newRangeError(msg), cause); } /** * Create a reference error (ECMA 15.11.6.3) * * @param msgId resource tag for error message * @param args arguments to resource * * @return the resulting {@link ECMAException} */ public static ECMAException referenceError(final String msgId, final String... args) { return referenceError(Context.getGlobal(), msgId, args); } /** * Create a reference error (ECMA 15.11.6.3) * * @param global global scope object * @param msgId resource tag for error message * @param args arguments to resource * * @return the resulting {@link ECMAException} */ public static ECMAException referenceError(final Global global, final String msgId, final String... args) { return referenceError(global, null, msgId, args); } /** * Create a reference error (ECMA 15.11.6.3) * * @param cause native Java {@code Throwable} that is the cause of error * @param msgId resource tag for error message * @param args arguments to resource * * @return the resulting {@link ECMAException} */ public static ECMAException referenceError(final Throwable cause, final String msgId, final String... args) { return referenceError(Context.getGlobal(), cause, msgId, args); } /** * Create a reference error (ECMA 15.11.6.3) * * @param global global scope object * @param cause native Java {@code Throwable} that is the cause of error * @param msgId resource tag for error message * @param args arguments to resource * * @return the resulting {@link ECMAException} */ public static ECMAException referenceError(final Global global, final Throwable cause, final String msgId, final String... args) { final String msg = getMessage("reference.error." + msgId, args); return error(global.newReferenceError(msg), cause); } /** * Create a URI error (ECMA 15.11.6.6) * * @param msgId resource tag for error message * @param args arguments to resource * * @return the resulting {@link ECMAException} */ public static ECMAException uriError(final String msgId, final String... args) { return uriError(Context.getGlobal(), msgId, args); } /** * Create a URI error (ECMA 15.11.6.6) * * @param global global scope object * @param msgId resource tag for error message * @param args arguments to resource * * @return the resulting {@link ECMAException} */ public static ECMAException uriError(final Global global, final String msgId, final String... args) { return uriError(global, null, msgId, args); } /** * Create a URI error (ECMA 15.11.6.6) * * @param cause native Java {@code Throwable} that is the cause of error * @param msgId resource tag for error message * @param args arguments to resource * * @return the resulting {@link ECMAException} */ public static ECMAException uriError(final Throwable cause, final String msgId, final String... args) { return uriError(Context.getGlobal(), cause, msgId, args); } /** * Create a URI error (ECMA 15.11.6.6) * * @param global global scope object * @param cause native Java {@code Throwable} that is the cause of error * @param msgId resource tag for error message * @param args arguments to resource * * @return the resulting {@link ECMAException} */ public static ECMAException uriError(final Global global, final Throwable cause, final String msgId, final String... args) { final String msg = getMessage("uri.error." + msgId, args); return error(global.newURIError(msg), cause); } /** * Get the exception message by placing the args in the resource defined * by the resource tag. This is visible to, e.g. the {@link jdk.nashorn.internal.parser.Parser} * can use it to generate compile time messages with the correct locale * * @param msgId the resource tag (message id) * @param args arguments to error string * * @return the filled out error string */ public static String getMessage(final String msgId, final String... args) { try { return new MessageFormat(MESSAGES_BUNDLE.getString(msgId)).format(args); } catch (final java.util.MissingResourceException e) { throw new RuntimeException("no message resource found for message id: "+ msgId); } } /** * Check if a stack trace element is in JavaScript * * @param frame frame * * @return true if frame is in the script */ public static boolean isScriptFrame(final StackTraceElement frame) { final String className = frame.getClassName(); // Look for script package in class name (into which compiler puts generated code) if (className.startsWith(scriptPackage) && !CompilerConstants.isInternalMethodName(frame.getMethodName())) { final String source = frame.getFileName(); // Make sure that it is not some Java code that Nashorn has in that package! return source != null && !source.endsWith(".java"); } return false; } }
⏎ jdk/nashorn/internal/runtime/ECMAErrors.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, 107846👍, 0💬
Popular Posts:
What JAR files are required to run dom\Writer.java provided in the Apache Xerces package? 3 JAR file...
Jackson is "the Java JSON library" or "the best JSON parser for Java". Or simply as "JSON for Java"....
Apache Commons Lang 3 is the 3rd version of Apache Commons Lang, which provides a host of helper uti...
JDK 11 jdk.charsets.jmod is the JMOD file for JDK 11 Charsets module. JDK 11 Charsets module compile...
JDK 11 jdk.jdi.jmod is the JMOD file for JDK 11 JDI (Java Debug Interface) tool. JDK 11 JDI tool com...