org.mozilla.javascript.Context.reportWarning()方法的使用及代码示例

x33g5p2x  于2022-01-18 转载在 JavaScript  
字(7.2k)|赞(0)|评价(0)|浏览(116)

本文整理了Java中org.mozilla.javascript.Context.reportWarning()方法的一些代码示例,展示了Context.reportWarning()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Context.reportWarning()方法的具体详情如下:
包路径:org.mozilla.javascript.Context
类名称:Context
方法名:reportWarning

Context.reportWarning介绍

[英]Report a warning using the error reporter for the current thread.
[中]使用当前线程的错误报告器报告警告。

代码示例

代码示例来源:origin: rhino/js

private static void warnAboutNonJSObject(Object nonJSObject)
  {
    String message =
"RHINO USAGE WARNING: Missed Context.javaToJS() conversion:\n"
+"Rhino runtime detected object "+nonJSObject+" of class "+nonJSObject.getClass().getName()+" where it expected String, Number, Boolean or Scriptable instance. Please check your code for missing Context.javaToJS() call.";
    Context.reportWarning(message);
    // Just to be sure that it would be noticed
    System.err.println(message);
  }

代码示例来源:origin: geogebra/geogebra

private static void warnAboutNonJSObject(Object nonJSObject)
  {
    String message =
"RHINO USAGE WARNING: Missed Context.javaToJS() conversion:\n"
+"Rhino runtime detected object "+nonJSObject+" of class "+nonJSObject.getClass().getName()+" where it expected String, Number, Boolean or Scriptable instance. Please check your code for missing Context.javaToJS() call.";
    Context.reportWarning(message);
    // Just to be sure that it would be noticed
    System.err.println(message);
  }

代码示例来源:origin: io.apigee/rhino

private static void warnAboutNonJSObject(Object nonJSObject)
  {
    String message =
"RHINO USAGE WARNING: Missed Context.javaToJS() conversion:\n"
+"Rhino runtime detected object "+nonJSObject+" of class "+nonJSObject.getClass().getName()+" where it expected String, Number, Boolean or Scriptable instance. Please check your code for missing Context.javaToJS() call.";
    Context.reportWarning(message);
    // Just to be sure that it would be noticed
    System.err.println(message);
  }

代码示例来源:origin: com.sun.phobos/phobos-rhino

private static void warnAboutNonJSObject(Object nonJSObject)
  {
    String message =
"RHINO USAGE WARNING: Missed Context.javaToJS() conversion:\n"
+"Rhino runtime detected object "+nonJSObject+" of class "+nonJSObject.getClass().getName()+" where it expected String, Number, Boolean or Scriptable instance. Please check your code for missing Context.javaToJS() call.";
    Context.reportWarning(message);
    // Just to be sure that it would be noticed
    System.err.println(message);
  }

代码示例来源:origin: rhino/js

/**
 * Report a warning using the error reporter for the current thread.
 *
 * @param message the warning message to report
 * @see org.mozilla.javascript.ErrorReporter
 */
public static void reportWarning(String message)
{
  int[] linep = { 0 };
  String filename = getSourcePositionFromStack(linep);
  Context.reportWarning(message, filename, linep[0], null, 0);
}

代码示例来源:origin: rhino/js

public static void reportWarning(String message, Throwable t)
{
  int[] linep = { 0 };
  String filename = getSourcePositionFromStack(linep);
  Writer sw = new StringWriter();
  PrintWriter pw = new PrintWriter(sw);
  pw.println(message);
  t.printStackTrace(pw);
  pw.flush();
  Context.reportWarning(sw.toString(), filename, linep[0], null, 0);
}

代码示例来源:origin: com.github.tntim96/rhino

public static void reportWarning(String message, Throwable t)
{
  int[] linep = { 0 };
  String filename = getSourcePositionFromStack(linep);
  Writer sw = new StringWriter();
  PrintWriter pw = new PrintWriter(sw);
  pw.println(message);
  t.printStackTrace(pw);
  pw.flush();
  Context.reportWarning(sw.toString(), filename, linep[0], null, 0);
}

代码示例来源:origin: ro.isdc.wro4j/rhino

public static void reportWarning(String message, Throwable t)
{
  int[] linep = { 0 };
  String filename = getSourcePositionFromStack(linep);
  Writer sw = new StringWriter();
  PrintWriter pw = new PrintWriter(sw);
  pw.println(message);
  t.printStackTrace(pw);
  pw.flush();
  Context.reportWarning(sw.toString(), filename, linep[0], null, 0);
}

代码示例来源:origin: io.apigee/rhino

public static void reportWarning(String message, Throwable t)
{
  int[] linep = { 0 };
  String filename = getSourcePositionFromStack(linep);
  Writer sw = new StringWriter();
  PrintWriter pw = new PrintWriter(sw);
  pw.println(message);
  t.printStackTrace(pw);
  pw.flush();
  Context.reportWarning(sw.toString(), filename, linep[0], null, 0);
}

代码示例来源:origin: ro.isdc.wro4j/rhino

/**
 * Report a warning using the error reporter for the current thread.
 *
 * @param message the warning message to report
 * @see org.mozilla.javascript.ErrorReporter
 */
public static void reportWarning(String message)
{
  int[] linep = { 0 };
  String filename = getSourcePositionFromStack(linep);
  Context.reportWarning(message, filename, linep[0], null, 0);
}

代码示例来源:origin: rhino/js

private static void reportWarning(Context cx, String messageId, String arg)
{
  if (cx.hasFeature(Context.FEATURE_STRICT_MODE)) {
    String msg = ScriptRuntime.getMessage1(messageId, arg);
    Context.reportWarning(msg);
  }
}

代码示例来源:origin: com.github.tntim96/rhino

private static void reportWarning(Context cx, String messageId, String arg)
{
  if (cx.hasFeature(Context.FEATURE_STRICT_MODE)) {
    String msg = ScriptRuntime.getMessage1(messageId, arg);
    Context.reportWarning(msg);
  }
}

代码示例来源:origin: ro.isdc.wro4j/rhino

private static void reportWarning(Context cx, String messageId, String arg)
{
  if (cx.hasFeature(Context.FEATURE_STRICT_MODE)) {
    String msg = ScriptRuntime.getMessage1(messageId, arg);
    Context.reportWarning(msg);
  }
}

代码示例来源:origin: com.sun.phobos/phobos-rhino

private static void reportWarning(Context cx, String messageId, String arg)
{
  if (cx.hasFeature(Context.FEATURE_STRICT_MODE)) {
    String msg = ScriptRuntime.getMessage1(messageId, arg);
    Context.reportWarning(msg);
  }
}

代码示例来源:origin: io.apigee/rhino

private static void reportWarning(Context cx, String messageId, String arg)
{
  if (cx.hasFeature(Context.FEATURE_STRICT_MODE)) {
    String msg = ScriptRuntime.getMessage1(messageId, arg);
    Context.reportWarning(msg);
  }
}

代码示例来源:origin: rhino/js

static void checkDeprecated(Context cx, String name) {
  int version = cx.getLanguageVersion();
  if (version >= Context.VERSION_1_4 || version == Context.VERSION_DEFAULT) {
    String msg = getMessage1("msg.deprec.ctor", name);
    if (version == Context.VERSION_DEFAULT)
      Context.reportWarning(msg);
    else
      throw Context.reportRuntimeError(msg);
  }
}

代码示例来源:origin: geogebra/geogebra

static void checkDeprecated(Context cx, String name) {
  int version = cx.getLanguageVersion();
  if (version >= Context.VERSION_1_4 || version == Context.VERSION_DEFAULT) {
    String msg = getMessage1("msg.deprec.ctor", name);
    if (version == Context.VERSION_DEFAULT)
      Context.reportWarning(msg);
    else
      throw Context.reportRuntimeError(msg);
  }
}

代码示例来源:origin: io.apigee/rhino

static void checkDeprecated(Context cx, String name) {
  int version = cx.getLanguageVersion();
  if (version >= Context.VERSION_1_4 || version == Context.VERSION_DEFAULT) {
    String msg = getMessage1("msg.deprec.ctor", name);
    if (version == Context.VERSION_DEFAULT)
      Context.reportWarning(msg);
    else
      throw Context.reportRuntimeError(msg);
  }
}

代码示例来源:origin: com.github.tntim96/rhino

static void checkDeprecated(Context cx, String name) {
  int version = cx.getLanguageVersion();
  if (version >= Context.VERSION_1_4 || version == Context.VERSION_DEFAULT) {
    String msg = getMessage1("msg.deprec.ctor", name);
    if (version == Context.VERSION_DEFAULT)
      Context.reportWarning(msg);
    else
      throw Context.reportRuntimeError(msg);
  }
}

代码示例来源:origin: com.sun.phobos/phobos-rhino

static void checkDeprecated(Context cx, String name) {
  int version = cx.getLanguageVersion();
  if (version >= Context.VERSION_1_4 || version == Context.VERSION_DEFAULT) {
    String msg = getMessage1("msg.deprec.ctor", name);
    if (version == Context.VERSION_DEFAULT)
      Context.reportWarning(msg);
    else
      throw Context.reportRuntimeError(msg);
  }
}

相关文章

微信公众号

Context类方法