Java Code Examples for jdk.nashorn.internal.runtime.ECMAErrors#getMessage()

The following examples show how to use jdk.nashorn.internal.runtime.ECMAErrors#getMessage() . 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: AssignSymbols.java    From openjdk-jdk9 with GNU General Public License v2.0 5 votes vote down vote up
private void throwUnprotectedSwitchError(final VarNode varNode) {
    // Block scoped declarations in switch statements without explicit blocks should be declared
    // in a common block that contains all the case clauses. We cannot support this without a
    // fundamental rewrite of how switch statements are handled (case nodes contain blocks and are
    // directly contained by switch node). As a temporary solution we throw a reference error here.
    final String msg = ECMAErrors.getMessage("syntax.error.unprotected.switch.declaration", varNode.isLet() ? "let" : "const");
    throwParserException(msg, varNode);
}
 
Example 2
Source File: Lower.java    From openjdk-jdk9 with GNU General Public License v2.0 5 votes vote down vote up
private void throwNotImplementedYet(final String msgId, final Node node) {
    final long token = node.getToken();
    final int line = source.getLine(node.getStart());
    final int column = source.getColumn(node.getStart());
    final String message = ECMAErrors.getMessage("unimplemented." + msgId);
    final String formatted = ErrorManager.format(message, source, line, column, token);
    throw new RuntimeException(formatted);
}
 
Example 3
Source File: AssignSymbols.java    From openjdk-jdk8u with GNU General Public License v2.0 5 votes vote down vote up
private void throwUnprotectedSwitchError(final VarNode varNode) {
    // Block scoped declarations in switch statements without explicit blocks should be declared
    // in a common block that contains all the case clauses. We cannot support this without a
    // fundamental rewrite of how switch statements are handled (case nodes contain blocks and are
    // directly contained by switch node). As a temporary solution we throw a reference error here.
    final String msg = ECMAErrors.getMessage("syntax.error.unprotected.switch.declaration", varNode.isLet() ? "let" : "const");
    throwParserException(msg, varNode);
}
 
Example 4
Source File: AssignSymbols.java    From jdk8u60 with GNU General Public License v2.0 5 votes vote down vote up
private void throwUnprotectedSwitchError(final VarNode varNode) {
    // Block scoped declarations in switch statements without explicit blocks should be declared
    // in a common block that contains all the case clauses. We cannot support this without a
    // fundamental rewrite of how switch statements are handled (case nodes contain blocks and are
    // directly contained by switch node). As a temporary solution we throw a reference error here.
    final String msg = ECMAErrors.getMessage("syntax.error.unprotected.switch.declaration", varNode.isLet() ? "let" : "const");
    throwParserException(msg, varNode);
}
 
Example 5
Source File: JSONParser.java    From hottub with GNU General Public License v2.0 4 votes vote down vote up
private ParserException syntaxError(final int start, final String reason) {
    final String message = ECMAErrors.getMessage("syntax.error.invalid.json", reason);
    return error(message, start);
}
 
Example 6
Source File: JSONParser.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 4 votes vote down vote up
private ParserException syntaxError(final int start, final String reason) {
    final String message = ECMAErrors.getMessage("syntax.error.invalid.json", reason);
    return error(message, start);
}
 
Example 7
Source File: JSONParser.java    From jdk8u_nashorn with GNU General Public License v2.0 4 votes vote down vote up
private ParserException syntaxError(final int start, final String reason) {
    final String message = ECMAErrors.getMessage("syntax.error.invalid.json", reason);
    return error(message, start);
}
 
Example 8
Source File: Lexer.java    From nashorn with GNU General Public License v2.0 2 votes vote down vote up
/**
 * Get the correctly localized error message for a given message id format arguments
 * @param msgId message id
 * @param args  format arguments
 * @return message
 */
protected static String message(final String msgId, final String... args) {
    return ECMAErrors.getMessage("lexer.error." + msgId, args);
}
 
Example 9
Source File: AbstractParser.java    From nashorn with GNU General Public License v2.0 2 votes vote down vote up
/**
 * Get the message string for a message ID and arguments
 *
 * @param msgId The Message ID
 * @param args  The arguments
 *
 * @return The message string
 */
protected static String message(final String msgId, final String... args) {
    return ECMAErrors.getMessage("parser.error." + msgId, args);
}
 
Example 10
Source File: Lexer.java    From jdk8u60 with GNU General Public License v2.0 2 votes vote down vote up
/**
 * Get the correctly localized error message for a given message id format arguments
 * @param msgId message id
 * @param args  format arguments
 * @return message
 */
protected static String message(final String msgId, final String... args) {
    return ECMAErrors.getMessage("lexer.error." + msgId, args);
}
 
Example 11
Source File: RegExp.java    From jdk8u60 with GNU General Public License v2.0 2 votes vote down vote up
/**
 * Throw a regexp parser exception.
 *
 * @param key the message key
 * @param str string argument
 * @throws jdk.nashorn.internal.runtime.ParserException unconditionally
 */
protected static void throwParserException(final String key, final String str) throws ParserException {
    throw new ParserException(ECMAErrors.getMessage("parser.error.regex." + key, str));
}
 
Example 12
Source File: Lexer.java    From jdk8u_nashorn with GNU General Public License v2.0 2 votes vote down vote up
/**
 * Get the correctly localized error message for a given message id format arguments
 * @param msgId message id
 * @param args  format arguments
 * @return message
 */
protected static String message(final String msgId, final String... args) {
    return ECMAErrors.getMessage("lexer.error." + msgId, args);
}
 
Example 13
Source File: AbstractParser.java    From TencentKona-8 with GNU General Public License v2.0 2 votes vote down vote up
/**
 * Get the message string for a message ID and arguments
 *
 * @param msgId The Message ID
 * @param args  The arguments
 *
 * @return The message string
 */
protected static String message(final String msgId, final String... args) {
    return ECMAErrors.getMessage("parser.error." + msgId, args);
}
 
Example 14
Source File: Lexer.java    From hottub with GNU General Public License v2.0 2 votes vote down vote up
/**
 * Get the correctly localized error message for a given message id format arguments
 * @param msgId message id
 * @param args  format arguments
 * @return message
 */
protected static String message(final String msgId, final String... args) {
    return ECMAErrors.getMessage("lexer.error." + msgId, args);
}
 
Example 15
Source File: Lexer.java    From openjdk-jdk8u with GNU General Public License v2.0 2 votes vote down vote up
/**
 * Get the correctly localized error message for a given message id format arguments
 * @param msgId message id
 * @param args  format arguments
 * @return message
 */
protected static String message(final String msgId, final String... args) {
    return ECMAErrors.getMessage("lexer.error." + msgId, args);
}
 
Example 16
Source File: RegExp.java    From openjdk-8-source with GNU General Public License v2.0 2 votes vote down vote up
/**
 * Throw a regexp parser exception.
 *
 * @param key the message key
 * @param str string argument
 * @throws jdk.nashorn.internal.runtime.ParserException unconditionally
 */
protected static void throwParserException(final String key, final String str) throws ParserException {
    throw new ParserException(ECMAErrors.getMessage("parser.error.regex." + key, str));
}
 
Example 17
Source File: Lexer.java    From TencentKona-8 with GNU General Public License v2.0 2 votes vote down vote up
/**
 * Get the correctly localized error message for a given message id format arguments
 * @param msgId message id
 * @param args  format arguments
 * @return message
 */
protected static String message(final String msgId, final String... args) {
    return ECMAErrors.getMessage("lexer.error." + msgId, args);
}
 
Example 18
Source File: AbstractParser.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 2 votes vote down vote up
/**
 * Get the message string for a message ID and arguments
 *
 * @param msgId The Message ID
 * @param args  The arguments
 *
 * @return The message string
 */
protected static String message(final String msgId, final String... args) {
    return ECMAErrors.getMessage("parser.error." + msgId, args);
}
 
Example 19
Source File: RegExp.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 2 votes vote down vote up
/**
 * Throw a regexp parser exception.
 *
 * @param key the message key
 * @param str string argument
 * @throws jdk.nashorn.internal.runtime.ParserException unconditionally
 */
protected static void throwParserException(final String key, final String str) throws ParserException {
    throw new ParserException(ECMAErrors.getMessage("parser.error.regex." + key, str));
}
 
Example 20
Source File: AbstractParser.java    From jdk8u_nashorn with GNU General Public License v2.0 2 votes vote down vote up
/**
 * Get the message string for a message ID and arguments
 *
 * @param msgId The Message ID
 * @param args  The arguments
 *
 * @return The message string
 */
protected static String message(final String msgId, final String... args) {
    return ECMAErrors.getMessage("parser.error." + msgId, args);
}