Skip to content
Permalink
Browse files
No logical reason to assert if warning called in non-verbose mode.
  • Loading branch information
headius committed Dec 8, 2014
1 parent ef5e72e commit 4da392f95c346593d57e1f3c540283287170e783
Showing with 4 additions and 8 deletions.
  1. +4 −8 core/src/main/java/org/jruby/common/RubyWarnings.java
@@ -126,7 +126,7 @@ public void warning(String message) {

@Override
public void warning(ID id, String message) {
if (!runtime.warningsEnabled()) return;
if (!runtime.warningsEnabled() || !runtime.isVerbose()) return;

RubyStackTraceElement[] stack = getRubyStackTrace(runtime);
String file;
@@ -148,8 +148,6 @@ public void warning(ID id, String message) {
*/
@Override
public void warning(ID id, ISourcePosition position, String message) {
if (!runtime.warningsEnabled()) return;

warning(id, position.getFile(), position.getStartLine() + 1, message);
}

@@ -158,9 +156,7 @@ public void warning(ID id, ISourcePosition position, String message) {
*/
@Override
public void warning(ID id, String fileName, int lineNumber, String message) {
assert isVerbose();

if (!runtime.warningsEnabled()) return;
if (!runtime.warningsEnabled() || !runtime.isVerbose()) return;

warn(id, fileName, lineNumber, message);
}
@@ -181,7 +177,7 @@ public void warn(ID id, ISourcePosition position, String message, Object... data
@Deprecated
@Override
public void warn(ID id, String fileName, int lineNumber, String message, Object... data) {
if (!runtime.warningsEnabled()) return; // TODO make an assert here
if (!runtime.warningsEnabled()) return;

StringBuilder buffer = new StringBuilder(100);

@@ -219,7 +215,7 @@ public void warning(ID id, ISourcePosition position, String message, Object... d
@Deprecated
@Override
public void warning(ID id, String fileName, int lineNumber, String message, Object... data) {
assert isVerbose();
if (!runtime.warningsEnabled() || !runtime.isVerbose()) return;
warn(id, fileName, lineNumber, message, data);
}
}

0 comments on commit 4da392f

Please sign in to comment.