@Override public void warn(String message) { getWarnings().warning(message); } };
/** * Prints a warning, only in verbose mode. */ @Override @Deprecated public void warning(ID id, ISourcePosition position, String message) { warning(id, position.getFile(), position.getLine(), message); }
/** * Verbose mode warning methods, their contract is that consumer must explicitly check for runtime.isVerbose() * before calling them */ public void warning(String message) { if (!isVerbose()) return; if (!runtime.warningsEnabled()) return; warning(ID.MISCELLANEOUS, message); }
@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); }
@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); }
private static void warnWrite(final Ruby runtime, IRubyObject maybeIO) { IRubyObject klass = maybeIO.getMetaClass(); char sep; if (((RubyClass) klass).isSingleton()) { klass = maybeIO; sep = '.'; } else { sep = '#'; } runtime.getWarnings().warning(klass.toString() + sep + "write is outdated interface which accepts just one argument"); }
private static void warnWrite(final Ruby runtime, IRubyObject maybeIO) { IRubyObject klass = maybeIO.getMetaClass(); char sep; if (((RubyClass) klass).isSingleton()) { klass = maybeIO; sep = '.'; } else { sep = '#'; } runtime.getWarnings().warning(klass.toString() + sep + "write is outdated interface which accepts just one argument"); }
public IRubyObject get(String name) { assert name != null; assert name.startsWith("$"); GlobalVariable variable = globalVariables.get(name); if (variable != null) return variable.getAccessor().getValue(); if (runtime.isVerbose()) { runtime.getWarnings().warning(ID.GLOBAL_NOT_INITIALIZED, "global variable `" + name + "' not initialized"); } return runtime.getNil(); }
/** * @see org.jruby.runtime.IAccessor#getValue() */ public IRubyObject getValue() { if (runtime.isVerbose()) { runtime.getWarnings().warning(ID.ACCESSOR_NOT_INITIALIZED, "global variable `" + name + "' not initialized"); } return runtime.getNil(); }
@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; }
@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); }
@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(); }
@JRubyMethod(name = "matchedsize") public IRubyObject matchedsize(ThreadContext context) { Ruby runtime = context.runtime; if (runtime.isVerbose()) { runtime.getWarnings().warning(ID.DEPRECATED_METHOD, "StringScanner#matchedsize is obsolete; use #matched_size instead"); } return matched_size(); }
@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(); }
@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); }
@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); }
@JRubyMethod(name = "default_internal=", required = 1, meta = true) public static IRubyObject setDefaultInternal(ThreadContext context, IRubyObject recv, IRubyObject encoding) { if (context.runtime.isVerbose()) context.runtime.getWarnings().warning("setting Encoding.default_internal"); EncodingUtils.rbEncSetDefaultInternal(context, encoding); return encoding; } }
@JRubyMethod(name = "clear") public IRubyObject clear(ThreadContext context) { check(); Ruby runtime = context.runtime; if (runtime.isVerbose()) { runtime.getWarnings().warning(ID.DEPRECATED_METHOD, "StringScanner#clear is obsolete; use #terminate instead"); } return terminate(); }
/** * initialize(enum = nil, &block) */ @JRubyMethod(visibility = Visibility.PRIVATE) // def initialize(enum = nil, &block) public IRubyObject initialize(ThreadContext context, Block block) { if ( block.isGiven() && context.runtime.isVerbose() ) { context.runtime.getWarnings().warning(IRubyWarnings.ID.BLOCK_UNUSED, "given block not used"); } allocHash(context.runtime); return this; }
@JIT public static IRubyObject getVariableWithAccessor(IRubyObject self, VariableAccessor accessor, ThreadContext context, String name) { Ruby runtime = context.runtime; IRubyObject result = (IRubyObject)accessor.get(self); if (result == null) { if (runtime.isVerbose()) { runtime.getWarnings().warning(IRubyWarnings.ID.IVAR_NOT_INITIALIZED, str(runtime, "instance variable ", ids(runtime, name)," not initialized")); } result = context.nil; } return result; }