diff --git a/core/src/main/java/org/jruby/RubyArray.java b/core/src/main/java/org/jruby/RubyArray.java index a9e6adf2725f..862545b3a8f7 100644 --- a/core/src/main/java/org/jruby/RubyArray.java +++ b/core/src/main/java/org/jruby/RubyArray.java @@ -645,7 +645,7 @@ public IRubyObject initialize(ThreadContext context, Block block) { unpack(); realLength = 0; if (block.isGiven() && context.runtime.isVerbose()) { - context.runtime.getWarnings().warning(ID.BLOCK_UNUSED, "given block not used"); + context.runtime.getWarnings().warn(ID.BLOCK_UNUSED, "given block not used"); } return this; } @@ -2549,7 +2549,7 @@ public IRubyObject index(ThreadContext context, IRubyObject obj) { @JRubyMethod(name = {"index", "find_index"}) public IRubyObject index(ThreadContext context, IRubyObject obj, Block unused) { - if (unused.isGiven()) context.runtime.getWarnings().warning(ID.BLOCK_UNUSED, "given block not used"); + if (unused.isGiven()) context.runtime.getWarnings().warn(ID.BLOCK_UNUSED, "given block not used"); return index(context, obj); } @@ -2656,7 +2656,7 @@ public IRubyObject rindex(ThreadContext context, IRubyObject obj) { @JRubyMethod public IRubyObject rindex(ThreadContext context, IRubyObject obj, Block unused) { - if (unused.isGiven()) context.runtime.getWarnings().warning(ID.BLOCK_UNUSED, "given block not used"); + if (unused.isGiven()) context.runtime.getWarnings().warn(ID.BLOCK_UNUSED, "given block not used"); return rindex(context, obj); } @@ -3521,7 +3521,7 @@ public IRubyObject count(ThreadContext context, Block block) { @JRubyMethod(name = "count") public IRubyObject count(ThreadContext context, IRubyObject obj, Block block) { - if (block.isGiven()) context.runtime.getWarnings().warning(ID.BLOCK_UNUSED, "given block not used"); + if (block.isGiven()) context.runtime.getWarnings().warn(ID.BLOCK_UNUSED, "given block not used"); int n = 0; for (int i = 0; i < realLength; i++) { @@ -4929,7 +4929,7 @@ public IRubyObject all_pCommon(ThreadContext context, IRubyObject arg, Block blo boolean patternGiven = arg != null; if (block.isGiven() && patternGiven) { - context.runtime.getWarnings().warning(ID.BLOCK_UNUSED, "given block not used"); + context.runtime.getWarnings().warn(ID.BLOCK_UNUSED, "given block not used"); } if (!block.isGiven() || patternGiven) return all_pBlockless(context, arg); @@ -4972,7 +4972,7 @@ public IRubyObject any_pCommon(ThreadContext context, IRubyObject arg, Block blo boolean patternGiven = arg != null; if (block.isGiven() && patternGiven) { - context.runtime.getWarnings().warning(ID.BLOCK_UNUSED, "given block not used"); + context.runtime.getWarnings().warn(ID.BLOCK_UNUSED, "given block not used"); } if (!block.isGiven() || patternGiven) return any_pBlockless(context, arg); @@ -5014,7 +5014,7 @@ public IRubyObject none_pCommon(ThreadContext context, IRubyObject arg, Block bl boolean patternGiven = arg != null; if (block.isGiven() && patternGiven) { - context.runtime.getWarnings().warning(ID.BLOCK_UNUSED, "given block not used"); + context.runtime.getWarnings().warn(ID.BLOCK_UNUSED, "given block not used"); } if (!block.isGiven() || patternGiven) return none_pBlockless(context, arg); @@ -5056,7 +5056,7 @@ public IRubyObject one_pCommon(ThreadContext context, IRubyObject arg, Block blo boolean patternGiven = arg != null; if (block.isGiven() && patternGiven) { - context.runtime.getWarnings().warning(ID.BLOCK_UNUSED, "given block not used"); + context.runtime.getWarnings().warn(ID.BLOCK_UNUSED, "given block not used"); } if (!block.isGiven() || patternGiven) return one_pBlockless(context, arg); diff --git a/core/src/main/java/org/jruby/RubyEnumerable.java b/core/src/main/java/org/jruby/RubyEnumerable.java index 1718be70cc69..334a3468520c 100644 --- a/core/src/main/java/org/jruby/RubyEnumerable.java +++ b/core/src/main/java/org/jruby/RubyEnumerable.java @@ -163,7 +163,7 @@ public static IRubyObject count(ThreadContext context, IRubyObject self, final I final Ruby runtime = context.runtime; final SingleInt result = new SingleInt(); - if (block.isGiven()) runtime.getWarnings().warning(ID.BLOCK_UNUSED , "given block not used"); + if (block.isGiven()) runtime.getWarnings().warn(ID.BLOCK_UNUSED , "given block not used"); each(context, eachSite(context), self, new JavaInternalBlockBody(runtime, context, "Enumerable#count", Signature.ONE_REQUIRED) { public IRubyObject yield(ThreadContext context1, IRubyObject[] args) { @@ -690,7 +690,7 @@ public static IRubyObject find_index(ThreadContext context, IRubyObject self, fi public static IRubyObject find_index(ThreadContext context, IRubyObject self, final IRubyObject cond, final Block block) { final Ruby runtime = context.runtime; - if (block.isGiven()) runtime.getWarnings().warning(ID.BLOCK_UNUSED , "given block not used"); + if (block.isGiven()) runtime.getWarnings().warn(ID.BLOCK_UNUSED , "given block not used"); if (self instanceof RubyArray) return ((RubyArray) self).find_index(context, cond); return find_indexCommon(context, eachSite(context), self, cond); @@ -1086,7 +1086,7 @@ public static IRubyObject inject(ThreadContext context, IRubyObject self, IRubyO public static IRubyObject inject(ThreadContext context, IRubyObject self, IRubyObject init, IRubyObject method, final Block block) { final Ruby runtime = context.runtime; - if (block.isGiven()) runtime.getWarnings().warning(ID.BLOCK_UNUSED , "given block not used"); + if (block.isGiven()) runtime.getWarnings().warn(ID.BLOCK_UNUSED , "given block not used"); final String methodId = method.asJavaString(); final SingleObject result = new SingleObject<>(init); @@ -1591,7 +1591,7 @@ public static IRubyObject none_pCommon(ThreadContext context, CallSite each, IRu final boolean patternGiven = pattern != null; if (block.isGiven() && patternGiven) { - context.runtime.getWarnings().warning(ID.BLOCK_UNUSED, "given block not used"); + context.runtime.getWarnings().warn(ID.BLOCK_UNUSED, "given block not used"); } try { @@ -1646,7 +1646,7 @@ public static IRubyObject one_pCommon(ThreadContext context, CallSite each, IRub final boolean patternGiven = pattern != null; if (block.isGiven() && patternGiven) { - context.runtime.getWarnings().warning(ID.BLOCK_UNUSED, "given block not used"); + context.runtime.getWarnings().warn(ID.BLOCK_UNUSED, "given block not used"); } try { @@ -1729,7 +1729,7 @@ public static IRubyObject all_pCommon(ThreadContext localContext, CallSite each, final boolean patternGiven = pattern != null; if (block.isGiven() && patternGiven) { - localContext.runtime.getWarnings().warning(ID.BLOCK_UNUSED, "given block not used"); + localContext.runtime.getWarnings().warn(ID.BLOCK_UNUSED, "given block not used"); } try { @@ -1819,7 +1819,7 @@ public static IRubyObject any_pCommon(ThreadContext localContext, CallSite site, final boolean patternGiven = pattern != null; if (block.isGiven() && patternGiven) { - localContext.runtime.getWarnings().warning(ID.BLOCK_UNUSED, "given block not used"); + localContext.runtime.getWarnings().warn(ID.BLOCK_UNUSED, "given block not used"); } try { diff --git a/core/src/main/java/org/jruby/RubyModule.java b/core/src/main/java/org/jruby/RubyModule.java index d25f32b3c20a..0c24ff0f3bc6 100644 --- a/core/src/main/java/org/jruby/RubyModule.java +++ b/core/src/main/java/org/jruby/RubyModule.java @@ -4912,9 +4912,9 @@ private IRubyObject setConstantCommon(String name, IRubyObject value, boolean hi if (notAutoload || !setAutoloadConstant(name, value, file, line)) { if (warn && notAutoload) { if (this.equals(getRuntime().getObject())) { - getRuntime().getWarnings().warning(ID.CONSTANT_ALREADY_INITIALIZED, "already initialized constant " + name); + getRuntime().getWarnings().warn(ID.CONSTANT_ALREADY_INITIALIZED, "already initialized constant " + name); } else { - getRuntime().getWarnings().warning(ID.CONSTANT_ALREADY_INITIALIZED, "already initialized constant " + this + "::" + name); + getRuntime().getWarnings().warn(ID.CONSTANT_ALREADY_INITIALIZED, "already initialized constant " + this + "::" + name); } } diff --git a/core/src/main/java/org/jruby/parser/RubyParserBase.java b/core/src/main/java/org/jruby/parser/RubyParserBase.java index a5e1a36f9340..75c3f99fdb97 100644 --- a/core/src/main/java/org/jruby/parser/RubyParserBase.java +++ b/core/src/main/java/org/jruby/parser/RubyParserBase.java @@ -1597,11 +1597,11 @@ public void warn(int line, String message) { // FIXME: Replace this with file/line version and stop using ISourcePosition public void warning(int line, String message) { - if (warnings.isVerbose()) warning(ID.USELESS_EXPRESSION, lexer.getFile(), line, message); + warning(ID.USELESS_EXPRESSION, lexer.getFile(), line, message); } public void warning(ID id, String file, int line, String message) { - warnings.warning(id, file, line + 1, message); // node/lexer lines are 0 based + warnings.warn(id, file, line + 1, message); // node/lexer lines are 0 based } // ENEBO: Totally weird naming (in MRI is not allocated and is a local var name) [1.9] diff --git a/core/src/main/java/org/jruby/util/StringSupport.java b/core/src/main/java/org/jruby/util/StringSupport.java index 8b1e9f818386..77bad8bcce8c 100644 --- a/core/src/main/java/org/jruby/util/StringSupport.java +++ b/core/src/main/java/org/jruby/util/StringSupport.java @@ -2071,7 +2071,7 @@ public static IRubyObject rbStrEnumerateLines(RubyString str, ThreadContext cont if (wantarray) { // this code should be live in 3.0 if (false) { // #if STRING_ENUMERATORS_WANTARRAY - runtime.getWarnings().warning(ID.BLOCK_UNUSED, "given block not used"); + runtime.getWarnings().warn(ID.BLOCK_UNUSED, "given block not used"); } else { runtime.getWarnings().warning(ID.BLOCK_DEPRECATED, "passing a block to String#lines is deprecated"); wantarray = false;