Skip to content

Commit

Permalink
Switch more error backquotes to single
Browse files Browse the repository at this point in the history
  • Loading branch information
headius committed Dec 12, 2024
1 parent 08dba44 commit 19e20e2
Show file tree
Hide file tree
Showing 9 changed files with 31 additions and 31 deletions.
4 changes: 2 additions & 2 deletions core/src/main/java/org/jruby/NativeException.java
Original file line number Diff line number Diff line change
Expand Up @@ -119,14 +119,14 @@ private static RubyArray joinedBacktrace(final Ruby runtime, final RubyArray rTr
final String className = element.getClassName();
line.setLength(0);
if (element.getFileName() == null) {
line.append(className).append(':').append(element.getLineNumber()).append(":in `").append(element.getMethodName()).append('\'');
line.append(className).append(':').append(element.getLineNumber()).append(":in '").append(element.getMethodName()).append('\'');
} else {
final int index = className.lastIndexOf('.');
if ( index > - 1 ) {
line.append(className.substring(0, index).replace('.', '/'));
line.append('/');
}
line.append(element.getFileName()).append(':').append(element.getLineNumber()).append(":in `").append(element.getMethodName()).append('\'');
line.append(element.getFileName()).append(':').append(element.getLineNumber()).append(":in '").append(element.getMethodName()).append('\'');
}
trace[i] = RubyString.newString(runtime, line.toString());
}
Expand Down
4 changes: 2 additions & 2 deletions core/src/main/java/org/jruby/RubyComplex.java
Original file line number Diff line number Diff line change
Expand Up @@ -447,7 +447,7 @@ public static IRubyObject convert(ThreadContext context, IRubyObject recv, IRuby
return a1 instanceof RubyComplex ? a1 : convertCommon(context, recv, a1, null, exception.isTrue());
}

throw argumentError(context, "`Complex': expected true or false as exception: " + exception);
throw argumentError(context, "'Complex': expected true or false as exception: " + exception);
}

/** nucomp_s_convert
Expand All @@ -468,7 +468,7 @@ public static IRubyObject convert(ThreadContext context, IRubyObject recv, IRuby
return convertCommon(context, recv, a1, a2, exception.isTrue());
}

throw argumentError(context, "`Complex': expected true or false as exception: " + exception);
throw argumentError(context, "'Complex': expected true or false as exception: " + exception);
}

// MRI: nucomp_s_convert
Expand Down
4 changes: 2 additions & 2 deletions core/src/main/java/org/jruby/RubyRange.java
Original file line number Diff line number Diff line change
Expand Up @@ -297,7 +297,7 @@ private void init(ThreadContext context, IRubyObject begin, IRubyObject end, boo
public IRubyObject initialize(ThreadContext context, IRubyObject[] args, Block unusedBlock) {
Arity.checkArgumentCount(context, args, 2, 3);

if (this.isInited) throw context.runtime.newFrozenError("`initialize' called twice", this);
if (this.isInited) throw context.runtime.newFrozenError("'initialize' called twice", this);
checkFrozen();
init(context, args[0], args[1], args.length > 2 && args[2].isTrue());
this.isInited = true;
Expand All @@ -306,7 +306,7 @@ public IRubyObject initialize(ThreadContext context, IRubyObject[] args, Block u

@JRubyMethod(visibility = PRIVATE)
public IRubyObject initialize_copy(ThreadContext context, IRubyObject original) {
if (this.isInited) throw context.runtime.newFrozenError("`initialize' called twice", this);
if (this.isInited) throw context.runtime.newFrozenError("'initialize' called twice", this);

RubyRange other = (RubyRange) original;
this.begin = other.begin;
Expand Down
18 changes: 9 additions & 9 deletions core/src/main/java/org/jruby/ext/ripper/RubyLexer.java
Original file line number Diff line number Diff line change
Expand Up @@ -1315,7 +1315,7 @@ private int ampersand(boolean spaceSeen) {
pushback(c);

if (IS_SPCARG(c, spaceSeen)) {
if (isVerbose()) warning("`&' interpreted as argument prefix");
if (isVerbose()) warning("'&' interpreted as argument prefix");
c = tAMPER;
} else if (IS_BEG()) {
c = warn_balanced(c, spaceSeen, tAMPER, "&", "argument prefix");
Expand Down Expand Up @@ -1343,19 +1343,19 @@ private int at() {

if (c == EOF || !isIdentifierChar(c)) {
if (result == tIVAR) {
compile_error("`@' without identifiers is not allowed as an instance variable name");
compile_error("'@' without identifiers is not allowed as an instance variable name");
} else {
compile_error("`@@' without identifiers is not allowed as a class variable name");
compile_error("'@@' without identifiers is not allowed as a class variable name");
}
set_yylval_noname();
setState(EXPR_END);
return result;
} else if (Character.isDigit(c)) {
pushback(c);
if (result == tIVAR) {
compile_error("`@" + ((char) c) + "' is not allowed as an instance variable name");
compile_error("'@" + ((char) c) + "' is not allowed as an instance variable name");
} else {
compile_error("`@@" + ((char) c) + "' is not allowed as a class variable name");
compile_error("'@@" + ((char) c) + "' is not allowed as a class variable name");
}
set_yylval_noname();
setState(EXPR_END);
Expand Down Expand Up @@ -1582,10 +1582,10 @@ private int dollar() {
default:
if (!isIdentifierChar(c)) {
if (c == EOF || isSpace(c)) {
compile_error("`$' without identifiers is not allowed as a global variable name");
compile_error("'$' without identifiers is not allowed as a global variable name");
} else {
pushback(c);
compile_error("`$" + ((char) c) + "' is not allowed as a global variable name");
compile_error("'$" + ((char) c) + "' is not allowed as a global variable name");
}
return EOF;
}
Expand Down Expand Up @@ -2212,7 +2212,7 @@ private int star(boolean spaceSeen) {
yaccValue = STAR_STAR;

if (IS_SPCARG(c, spaceSeen)) {
if (isVerbose() && Options.PARSER_WARN_ARGUMENT_PREFIX.load()) warning("`**' interpreted as argument prefix");
if (isVerbose() && Options.PARSER_WARN_ARGUMENT_PREFIX.load()) warning("'**' interpreted as argument prefix");
c = tDSTAR;
} else if (IS_BEG()) {
c = tDSTAR;
Expand All @@ -2228,7 +2228,7 @@ private int star(boolean spaceSeen) {
default:
pushback(c);
if (IS_SPCARG(c, spaceSeen)) {
if (isVerbose() && Options.PARSER_WARN_ARGUMENT_PREFIX.load()) warning("`*' interpreted as argument prefix");
if (isVerbose() && Options.PARSER_WARN_ARGUMENT_PREFIX.load()) warning("'*' interpreted as argument prefix");
c = tSTAR;
} else if (IS_BEG()) {
c = tSTAR;
Expand Down
4 changes: 2 additions & 2 deletions core/src/main/java/org/jruby/ext/socket/RubyBasicSocket.java
Original file line number Diff line number Diff line change
Expand Up @@ -649,7 +649,7 @@ public IRubyObject shutdown(ThreadContext context, IRubyObject[] args) {
} else if (howString.equals("RDWR") || howString.equals("SHUT_RDWR")) {
how = 2;
} else {
throw SocketUtils.sockerr(context.runtime, "`how' should be either :SHUT_RD, :SHUT_WR, :SHUT_RDWR");
throw SocketUtils.sockerr(context.runtime, "'how' should be either :SHUT_RD, :SHUT_WR, :SHUT_RDWR");
}
} else {
how = RubyNumeric.fix2int(args[0]);
Expand Down Expand Up @@ -872,7 +872,7 @@ private static IRubyObject shutdownInternal(ThreadContext context, OpenFile fptr

return RubyFixnum.zero(context.runtime);
default:
throw argumentError(context, "`how' should be either :SHUT_RD, :SHUT_WR, :SHUT_RDWR");
throw argumentError(context, "'how' should be either :SHUT_RD, :SHUT_WR, :SHUT_RDWR");
}
}

Expand Down
18 changes: 9 additions & 9 deletions core/src/main/java/org/jruby/lexer/yacc/RubyLexer.java
Original file line number Diff line number Diff line change
Expand Up @@ -1232,7 +1232,7 @@ private int ampersand(boolean spaceSeen) {
int tmpLine = ruby_sourceline;
if (IS_SPCARG(c, spaceSeen)) {
if (warnings.isVerbose() && Options.PARSER_WARN_ARGUMENT_PREFIX.load())
warning(ID.ARGUMENT_AS_PREFIX, getFile(), tmpLine, "`&' interpreted as argument prefix");
warning(ID.ARGUMENT_AS_PREFIX, getFile(), tmpLine, "'&' interpreted as argument prefix");
c = tAMPER;
} else if (IS_BEG()) {
c = tAMPER;
Expand Down Expand Up @@ -1260,18 +1260,18 @@ private int at() {

if (c == EOF || !isIdentifierChar(c)) {
if (result == tIVAR) {
compile_error("`@' without identifiers is not allowed as an instance variable name");
compile_error("'@' without identifiers is not allowed as an instance variable name");
} else {
compile_error("`@@' without identifiers is not allowed as a class variable name");
compile_error("'@@' without identifiers is not allowed as a class variable name");
}
setState(EXPR_END);
return result;
} else if (Character.isDigit(c)) {
pushback(c);
if (result == tIVAR) {
compile_error("`@" + ((char) c) + "' is not allowed as an instance variable name");
compile_error("'@" + ((char) c) + "' is not allowed as an instance variable name");
} else {
compile_error("`@@" + ((char) c) + "' is not allowed as a class variable name");
compile_error("'@@" + ((char) c) + "' is not allowed as a class variable name");
}
setState(EXPR_END);
return result;
Expand Down Expand Up @@ -1500,10 +1500,10 @@ private int dollar() {
default:
if (!isIdentifierChar(c)) {
if (c == EOF || isSpace(c)) {
compile_error("`$' without identifiers is not allowed as a global variable name");
compile_error("'$' without identifiers is not allowed as a global variable name");
} else {
pushback(c);
compile_error("`$" + ((char) c) + "' is not allowed as a global variable name");
compile_error("'$" + ((char) c) + "' is not allowed as a global variable name");
}
}

Expand Down Expand Up @@ -2107,7 +2107,7 @@ private int star(boolean spaceSeen) {

if (IS_SPCARG(c, spaceSeen)) {
if (warnings.isVerbose() && Options.PARSER_WARN_ARGUMENT_PREFIX.load())
warning(ID.ARGUMENT_AS_PREFIX, "`**' interpreted as argument prefix");
warning(ID.ARGUMENT_AS_PREFIX, "'**' interpreted as argument prefix");
c = tDSTAR;
} else if (IS_BEG()) {
c = tDSTAR;
Expand All @@ -2124,7 +2124,7 @@ private int star(boolean spaceSeen) {
pushback(c);
if (IS_SPCARG(c, spaceSeen)) {
if (warnings.isVerbose() && Options.PARSER_WARN_ARGUMENT_PREFIX.load())
warning(ID.ARGUMENT_AS_PREFIX, "`*' interpreted as argument prefix");
warning(ID.ARGUMENT_AS_PREFIX, "'*' interpreted as argument prefix");
c = tSTAR;
} else if (IS_BEG()) {
c = tSTAR;
Expand Down
6 changes: 3 additions & 3 deletions core/src/main/java/org/jruby/runtime/Helpers.java
Original file line number Diff line number Diff line change
Expand Up @@ -1929,7 +1929,7 @@ public static RubyArray arrayValue(ThreadContext context, IRubyObject value) {
if (avalue instanceof RubyArray ary) return ary;
if (avalue.isNil()) return newArray(context, value);

throw typeError(context, "`to_a' did not return Array");
throw typeError(context, "'to_a' did not return Array");
} else {
CacheEntry entry = value.getMetaClass().searchWithCache("method_missing");
DynamicMethod methodMissing = entry.method;
Expand All @@ -1942,7 +1942,7 @@ public static RubyArray arrayValue(ThreadContext context, IRubyObject value) {
if (avalue.isNil()) {
return newArray(context, value);
} else {
throw typeError(context, "`to_a' did not return Array");
throw typeError(context, "'to_a' did not return Array");
}
}
return (RubyArray<?>)avalue;
Expand Down Expand Up @@ -2037,7 +2037,7 @@ private static IRubyObject[] convertSplatToJavaArray(ThreadContext context, IRub
if (avalue.isNil()) {
return new IRubyObject[] {value};
} else {
throw typeError(context, "`to_a' did not return Array");
throw typeError(context, "'to_a' did not return Array");
}
}
return ((RubyArray)avalue).toJavaArray(context);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ public final CharSequence mriStyleString() {
// return fileName + ':' + lineNumber + ":in '" + methodName + '\'';
return new StringBuilder(fileName.length() + methodName.length() + 12).
append(fileName).append(':').append(lineNumber).
append(":in `").append(methodName).append('\'');
append(":in '").append(methodName).append('\'');
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -723,7 +723,7 @@ private static void renderBacktraceMRI(RubyStackTraceElement[] trace, String lin
.append(element.getFileName())
.append(':')
.append(element.getLineNumber())
.append(":in `")
.append(":in '")
.append(element.getMethodName())
.append("'\n");
}
Expand Down

0 comments on commit 19e20e2

Please sign in to comment.