本文整理汇总了Java中jdk.nashorn.internal.runtime.ECMAErrors.getMessage方法的典型用法代码示例。如果您正苦于以下问题:Java ECMAErrors.getMessage方法的具体用法?Java ECMAErrors.getMessage怎么用?Java ECMAErrors.getMessage使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类jdk.nashorn.internal.runtime.ECMAErrors
的用法示例。
在下文中一共展示了ECMAErrors.getMessage方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: throwUnprotectedSwitchError
import jdk.nashorn.internal.runtime.ECMAErrors; //导入方法依赖的package包/类
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);
}
示例2: throwNotImplementedYet
import jdk.nashorn.internal.runtime.ECMAErrors; //导入方法依赖的package包/类
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);
}
示例3: syntaxError
import jdk.nashorn.internal.runtime.ECMAErrors; //导入方法依赖的package包/类
private ParserException syntaxError(final int start, final String reason) {
final String message = ECMAErrors.getMessage("syntax.error.invalid.json", reason);
return error(message, start);
}
示例4: message
import jdk.nashorn.internal.runtime.ECMAErrors; //导入方法依赖的package包/类
/**
* 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);
}
示例5: message
import jdk.nashorn.internal.runtime.ECMAErrors; //导入方法依赖的package包/类
/**
* 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);
}
示例6: throwParserException
import jdk.nashorn.internal.runtime.ECMAErrors; //导入方法依赖的package包/类
/**
* 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));
}