org.jruby.Ruby.getWarnings()方法的使用及代码示例

x33g5p2x  于2022-01-29 转载在 其他  
字(6.4k)|赞(0)|评价(0)|浏览(120)

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

Ruby.getWarnings介绍

暂无

代码示例

代码示例来源:origin: org.jruby/jruby-complete

@Override
public IRubyObject set(IRubyObject value) {
  runtime.getWarnings().warn(ID.INEFFECTIVE_GLOBAL, "warning: variable " + name + " is no longer effective; ignored");
  return value;
}

代码示例来源:origin: org.jruby/jruby-complete

@JRubyMethod
public IRubyObject chars(final ThreadContext context, final Block block) {
  context.runtime.getWarnings().warn("StringIO#chars is deprecated; use #each_char instead");
  return each_char(context, block);
}

代码示例来源:origin: org.jruby/jruby-complete

@JRubyMethod(name = "listen")
public IRubyObject listen(ThreadContext context, IRubyObject backlog) {
  context.runtime.getWarnings().warnOnce(
      IRubyWarnings.ID.LISTEN_SERVER_SOCKET,
      "pass backlog to #bind instead of #listen (http://wiki.jruby.org/ServerSocket)");
  return context.runtime.newFixnum(0);
}

代码示例来源:origin: org.jruby/jruby-complete

@Deprecated // no to be used in user-lang
@JRubyMethod(name = "new", meta = true)
public static RubyBigDecimal new_(ThreadContext context, IRubyObject recv, IRubyObject arg) {
  context.runtime.getWarnings().warning(IRubyWarnings.ID.DEPRECATED_METHOD, "BigDecimal.new is deprecated");
  return newInstance(context, recv, arg);
}

代码示例来源:origin: org.jruby/jruby-complete

/** rb_hash_index
 *
 */
@JRubyMethod(name = "index")
public IRubyObject index(ThreadContext context, IRubyObject expected) {
  context.runtime.getWarnings().warn(ID.DEPRECATED_METHOD, "Hash#index is deprecated; use Hash#key");
  return key(context, expected);
}

代码示例来源:origin: org.jruby/jruby-complete

@JRubyMethod(name = "getbyte")
public IRubyObject getbyte(ThreadContext context) {
  Ruby runtime = context.runtime;
  if (runtime.isVerbose()) {
    runtime.getWarnings().warning(ID.DEPRECATED_METHOD,
        "StringScanner#getbyte is obsolete; use #get_byte instead");
  }
  return get_byte(context);
}

代码示例来源:origin: org.jruby/jruby-core

public void warn(WARNING_ID id, String message, Object... data) {
  ID ourID;
  if (id == WARNING_ID.DUMMY_VALUE_USED) {
    ourID = ID.DUMMY_VALUE_USED;
  } else {
    ourID = ID.MISCELLANEOUS;
  }
  runtime.getWarnings().warn(ourID, message);
}

代码示例来源:origin: org.jruby/jruby-complete

@JRubyMethod(meta = true)
public static IRubyObject ver(ThreadContext context, IRubyObject recv) {
  context.runtime.getWarnings().warn(IRubyWarnings.ID.DEPRECATED_METHOD, "BigDecimal.ver is deprecated; use BigDecimal::VERSION instead");
  return RubyString.newStringShared(context.runtime, VERSION);
}

代码示例来源:origin: org.jruby/jruby-complete

@JRubyMethod(name = "empty?")
public RubyBoolean empty_p(ThreadContext context) {
  Ruby runtime = context.runtime;
  if (runtime.isVerbose()) {
    runtime.getWarnings().warning(ID.DEPRECATED_METHOD, "StringScanner#empty? is obsolete; use #eos? instead");
  }
  return eos_p(context);
}

代码示例来源:origin: org.jruby/jruby-complete

private static IRubyObject[] dropLastArgIfOptions(final Ruby runtime, final IRubyObject[] args) {
  IRubyObject lastArg = args[args.length - 1];
  if (lastArg instanceof RubyHash) {
    if (!((RubyHash) lastArg).isEmpty()) {
      runtime.getWarnings().warn(ID.UNSUPPORTED_SUBPROCESS_OPTION, "system does not support options in JRuby yet: " + lastArg);
    }
    return Arrays.copyOf(args, args.length - 1);
  }
  return args;
}

代码示例来源:origin: org.jruby/jruby-complete

@JRubyMethod(name = "chars")
public IRubyObject chars(ThreadContext context, Block block) {
  context.runtime.getWarnings().warn("IO#chars is deprecated; use #each_char instead");
  return each_charInternal(context, block);
}

代码示例来源:origin: org.jruby/jruby-complete

@JRubyMethod(name = "default_external=", meta = true)
public static IRubyObject setDefaultExternal(ThreadContext context, IRubyObject recv, IRubyObject encoding) {
  if (context.runtime.isVerbose()) context.runtime.getWarnings().warning("setting Encoding.default_external");
  EncodingUtils.rbEncSetDefaultExternal(context, encoding);
  return encoding;
}

代码示例来源:origin: org.jruby/jruby-core

private static IRubyObject[] dropLastArgIfOptions(final Ruby runtime, final IRubyObject[] args) {
  IRubyObject lastArg = args[args.length - 1];
  if (lastArg instanceof RubyHash) {
    if (!((RubyHash) lastArg).isEmpty()) {
      runtime.getWarnings().warn(ID.UNSUPPORTED_SUBPROCESS_OPTION, "system does not support options in JRuby yet: " + lastArg);
    }
    return Arrays.copyOf(args, args.length - 1);
  }
  return args;
}

代码示例来源:origin: org.jruby/jruby-complete

@JRubyMethod
public IRubyObject codepoints(ThreadContext context, Block block) {
  context.runtime.getWarnings().warn("IO#codepoints is deprecated; use #each_codepoint instead");
  return eachCodePointCommon(context, block, "each_codepoint");
}

代码示例来源:origin: org.jruby/jruby-complete

@JRubyMethod(name = "peep", required = 1)
public IRubyObject peep(ThreadContext context, IRubyObject length) {
  Ruby runtime = context.runtime;
  if (runtime.isVerbose()) {
    runtime.getWarnings().warning(
        ID.DEPRECATED_METHOD, "StringScanner#peep is obsolete; use #peek instead");
  }
  return peek(context, length);
}

代码示例来源:origin: org.jruby/jruby-complete

/** rb_obj_type
 *
 * The deprecated version of type, that emits a deprecation
 * warning.
 */
@Deprecated
public RubyClass type_deprecated() {
  getRuntime().getWarnings().warn(ID.DEPRECATED_METHOD, "Object#type is deprecated; use Object#class");
  return type();
}

代码示例来源:origin: org.jruby/jruby-core

/** rb_hash_index
 *
 */
@JRubyMethod(name = "index")
public IRubyObject index(ThreadContext context, IRubyObject expected) {
  context.runtime.getWarnings().warn(ID.DEPRECATED_METHOD, "Hash#index is deprecated; use Hash#key");
  return key(context, expected);
}

代码示例来源:origin: org.jruby/jruby-complete

@JRubyMethod(name = "restsize")
public RubyFixnum restsize(ThreadContext context) {
  Ruby runtime = context.runtime;
  if (runtime.isVerbose()) {
    runtime.getWarnings().warning(ID.DEPRECATED_METHOD, "StringScanner#restsize is obsolete; use #rest_size instead");
  }
  return rest_size();
}

代码示例来源:origin: org.jruby/jruby-complete

static void checkUnsupportedOptions(ThreadContext context, RubyHash opts, String[] unsupported, String error) {
  final Ruby runtime = context.runtime;
  for (String key : unsupported) {
    if (opts.fastARef(runtime.newSymbol(key)) != null) {
      runtime.getWarnings().warn(error + ": " + key);
    }
  }
}

代码示例来源:origin: org.jruby/jruby-core

@JRubyMethod(name = "bytes")
public IRubyObject bytes(ThreadContext context, Block block) {
  context.runtime.getWarnings().warn("IO#bytes is deprecated; use #each_byte instead");
  return each_byte(context, block);
}

相关文章

Ruby类方法