Skip to content

Commit

Permalink
A few more places we used backquote in error msg
Browse files Browse the repository at this point in the history
  • Loading branch information
headius committed Oct 14, 2024
1 parent 54e5d7a commit d68025e
Show file tree
Hide file tree
Showing 7 changed files with 20 additions and 20 deletions.
2 changes: 1 addition & 1 deletion core/src/main/java/org/jruby/Ruby.java
Original file line number Diff line number Diff line change
Expand Up @@ -1476,7 +1476,7 @@ public RubyClass defineClassUnder(String id, RubyClass superClass, ObjectAllocat
if (superClass == null) {
IRubyObject className = parentIsObject ? ids(this, id) :
parent.toRubyString(getCurrentContext()).append(newString("::")).append(ids(this, id));
warnings.warn(ID.NO_SUPER_CLASS, str(this, "no super class for `", className, "', Object assumed"));
warnings.warn(ID.NO_SUPER_CLASS, str(this, "no super class for '", className, "', Object assumed"));

superClass = objectClass;
}
Expand Down
6 changes: 3 additions & 3 deletions core/src/main/java/org/jruby/RubyBasicObject.java
Original file line number Diff line number Diff line change
Expand Up @@ -2405,7 +2405,7 @@ public IRubyObject singleton_method(IRubyObject name) {
return newMethod;
}
}
throw getRuntime().newNameError(str(getRuntime(), "undefined method `", symbol, "' for `", inspect(), "'"), symbol);
throw getRuntime().newNameError(str(getRuntime(), "undefined method '", symbol, "' for '", inspect(), "'"), symbol);
}

/** rb_obj_method
Expand Down Expand Up @@ -2850,7 +2850,7 @@ protected static int nonFixnumHashCode(IRubyObject hashValue) {
protected String validateInstanceVariable(String name) {
if (IdUtil.isValidInstanceVariableName(name)) return name;

throw getRuntime().newNameError("`%1$s' is not allowable as an instance variable name", this, name);
throw getRuntime().newNameError("'%1$s' is not allowable as an instance variable name", this, name);
}

@Deprecated
Expand All @@ -2861,7 +2861,7 @@ protected String validateInstanceVariable(IRubyObject name, String _unused_) {
protected String validateInstanceVariable(IRubyObject name) {
return RubySymbol.retrieveIDSymbol(name, (sym, newSym) -> {
if (!sym.validInstanceVariableName()) {
throw getRuntime().newNameError("`%1$s' is not allowable as an instance variable name", this, name);
throw getRuntime().newNameError("'%1$s' is not allowable as an instance variable name", this, name);
}
}).idString();
}
Expand Down
4 changes: 2 additions & 2 deletions core/src/main/java/org/jruby/RubyBinding.java
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,7 @@ public IRubyObject local_variable_get(ThreadContext context, IRubyObject symbol)
DynamicScope evalScope = binding.getEvalScope(context.runtime);
int slot = evalScope.getStaticScope().isDefined(id);

if (slot == -1) throw context.runtime.newNameError(str(context.runtime, "local variable `", symbol, "' not defined for " + inspect()), symbol);
if (slot == -1) throw context.runtime.newNameError(str(context.runtime, "local variable '", symbol, "' not defined for " + inspect()), symbol);

return evalScope.getValueOrNil(slot & 0xffff, slot >> 16, context.nil);
}
Expand All @@ -182,7 +182,7 @@ private String checkLocalId(ThreadContext context, IRubyObject obj) {
String id = RubySymbol.checkID(obj);

if (!RubyLexer.isIdentifierChar(id.charAt(0))) {
throw context.runtime.newNameError(str(context.runtime, "wrong local variable name `", obj, "' for ", this), id);
throw context.runtime.newNameError(str(context.runtime, "wrong local variable name '", obj, "' for ", this), id);
}

return id;
Expand Down
12 changes: 6 additions & 6 deletions core/src/main/java/org/jruby/RubyKernel.java
Original file line number Diff line number Diff line change
Expand Up @@ -240,16 +240,16 @@ public static IRubyObject methodMissing(ThreadContext context, IRubyObject recv,

private static String getMethodMissingFormat(Visibility visibility, CallType callType) {

String format = "undefined method `%s' for %s%s%s";
String format = "undefined method '%s' for %s%s%s";

if (visibility == PRIVATE) {
format = "private method `%s' called for %s%s%s";
format = "private method '%s' called for %s%s%s";
} else if (visibility == PROTECTED) {
format = "protected method `%s' called for %s%s%s";
format = "protected method '%s' called for %s%s%s";
} else if (callType == CallType.VARIABLE) {
format = "undefined local variable or method `%s' for %s%s%s";
format = "undefined local variable or method '%s' for %s%s%s";
} else if (callType == CallType.SUPER) {
format = "super: no superclass method `%s' for %s%s%s";
format = "super: no superclass method '%s' for %s%s%s";
}

return format;
Expand Down Expand Up @@ -1153,7 +1153,7 @@ private static void printExceptionSummary(Ruby runtime, RubyException rEx) {
RubyStackTraceElement[] elements = rEx.getBacktraceElements();
RubyStackTraceElement firstElement = elements.length > 0 ? elements[0] :
new RubyStackTraceElement("", "", "(empty)", 0, false);
String msg = String.format("Exception `%s' at %s:%s - %s\n",
String msg = String.format("Exception '%s' at %s:%s - %s\n",
rEx.getMetaClass(),
firstElement.getFileName(), firstElement.getLineNumber(),
TypeConverter.convertToType(rEx, runtime.getString(), "to_s"));
Expand Down
12 changes: 6 additions & 6 deletions core/src/main/java/org/jruby/RubyModule.java
Original file line number Diff line number Diff line change
Expand Up @@ -1531,7 +1531,7 @@ private void raiseUndefinedNameError(String name, Ruby runtime) {
}

// FIXME: Since we found no method we probably do not have symbol entry...do not want to pollute symbol table here.
throw runtime.newNameError(str(runtime, "undefined method '" + name + "' for" + s0 + " `", c, "'"), name);
throw runtime.newNameError(str(runtime, "undefined method '" + name + "' for" + s0 + " '", c, "'"), name);
}

@JRubyMethod(name = "include?")
Expand Down Expand Up @@ -1653,7 +1653,7 @@ public void removeMethod(ThreadContext context, String id) {

private static void warnMethodRemoval(final ThreadContext context, final String id) {
context.runtime.getWarnings().warn(ID.UNDEFINING_BAD,
str(context.runtime, "removing `", ids(context.runtime, id), "' may cause serious problems"));
str(context.runtime, "removing '", ids(context.runtime, id), "' may cause serious problems"));
}

/**
Expand Down Expand Up @@ -2454,7 +2454,7 @@ private CacheEntry deepMethodSearch(String id, Ruby runtime) {
}

public static String undefinedMethodMessage(Ruby runtime, IRubyObject name, IRubyObject modName, boolean isModule) {
return str(runtime, "undefined method `", name, "' for " + (isModule ? "module" : "class") + " `", modName, "'");
return str(runtime, "undefined method '", name, "' for " + (isModule ? "module" : "class") + " '", modName, "'");
}

/**
Expand Down Expand Up @@ -5406,21 +5406,21 @@ protected final String validateClassVariable(String name) {
if (IdUtil.isValidClassVariableName(name)) {
return name;
}
throw getRuntime().newNameError("`%1$s' is not allowed as a class variable name", this, name);
throw getRuntime().newNameError("'%1$s' is not allowed as a class variable name", this, name);
}

protected final String validateClassVariable(IRubyObject nameObj, String name) {
if (IdUtil.isValidClassVariableName(name)) {
return name;
}
throw getRuntime().newNameError("`%1$s' is not allowed as a class variable name", this, nameObj);
throw getRuntime().newNameError("'%1$s' is not allowed as a class variable name", this, nameObj);
}

protected String validateClassVariable(Ruby runtime, IRubyObject object) {
RubySymbol name = TypeConverter.checkID(object);

if (!name.validClassVariableName()) {
throw getRuntime().newNameError(str(runtime, "`", ids(runtime, name), "' is not allowed as a class variable name"), this, object);
throw getRuntime().newNameError(str(runtime, "'", ids(runtime, name), "' is not allowed as a class variable name"), this, object);
}

return name.idString();
Expand Down
2 changes: 1 addition & 1 deletion core/src/main/java/org/jruby/ext/ripper/RubyLexer.java
Original file line number Diff line number Diff line change
Expand Up @@ -460,7 +460,7 @@ public void setParser(RipperParserBase parserSupport) {
@Override
protected void setCompileOptionFlag(String name, ByteList value) {
if (tokenSeen) {
warning("`%s' is ignored after any tokens", name);
warning("'%s' is ignored after any tokens", name);
return;
}
}
Expand Down
2 changes: 1 addition & 1 deletion core/src/main/java/org/jruby/runtime/Helpers.java
Original file line number Diff line number Diff line change
Expand Up @@ -2196,7 +2196,7 @@ public static Visibility performNormalMethodChecksAndDetermineVisibility(Ruby ru
switch(symbol.idString()) {
case "__id__":
case "__send__":
runtime.getWarnings().warn(ID.REDEFINING_DANGEROUS, str(runtime, "redefining `", ids(runtime, symbol), "' may cause serious problem"));
runtime.getWarnings().warn(ID.REDEFINING_DANGEROUS, str(runtime, "redefining '", ids(runtime, symbol), "' may cause serious problem"));
break;
case "initialize":
if (clazz == runtime.getObject()) {
Expand Down

0 comments on commit d68025e

Please sign in to comment.