Skip to content

Commit

Permalink
Showing 31 changed files with 61 additions and 134 deletions.
6 changes: 3 additions & 3 deletions core/src/main/java/org/jruby/BasicObjectStub.java
Original file line number Diff line number Diff line change
@@ -179,7 +179,7 @@ public static RubyInteger convertToInteger(IRubyObject self, int convertMethodIn

public static RubyInteger convertToInteger(IRubyObject self, String convertMethod) {
IRubyObject val = TypeConverter.convertToType(self, getRuntime(self).getInteger(), convertMethod, true);
if (!(val instanceof RubyInteger)) throw getRuntime(self).newTypeError(getMetaClass(self).getName() + "#" + convertMethod + " should return Integer");
if (!(val instanceof RubyInteger)) throw getRuntime(self).newTypeError(getMetaClass(self).getName() + '#' + convertMethod + " should return Integer");
return (RubyInteger)val;
}

@@ -255,11 +255,11 @@ private static StringBuilder inspectObj(IRubyObject self, StringBuilder part) {
String sep = "";

for (Variable<IRubyObject> ivar : getInstanceVariables(self).getInstanceVariableList()) {
part.append(sep).append(" ").append(ivar.getName()).append("=");
part.append(sep).append(' ').append(ivar.getName()).append('=');
part.append(invokedynamic(context, ivar.getValue(), INSPECT));
sep = ",";
}
part.append(">");
part.append('>');
return part;
}

25 changes: 9 additions & 16 deletions core/src/main/java/org/jruby/NativeException.java
Original file line number Diff line number Diff line change
@@ -88,19 +88,14 @@ public IRubyObject backtrace() {
StackTraceElement[] stackTrace = cause.getStackTrace();
for (int i = stackTrace.length - 1; i >= 0; i--) {
StackTraceElement element = stackTrace[i];
String className = element.getClassName();
String line = null;
final String className = element.getClassName();
final String line;
if (element.getFileName() == null) {
line = className + ":" + element.getLineNumber() + ":in `" + element.getMethodName() + "'";
line = className + ':' + element.getLineNumber() + ":in `" + element.getMethodName() + '\'';
} else {
int index = className.lastIndexOf(".");
String packageName = null;
if (index == -1) {
packageName = "";
} else {
packageName = className.substring(0, index) + "/";
}
line = packageName.replace(".", "/") + element.getFileName() + ":" + element.getLineNumber() + ":in `" + element.getMethodName() + "'";
final int index = className.lastIndexOf('.');
final String packageName = index == -1 ? "" : className.substring(0, index) + '/';
line = packageName.replace('.', '/') + element.getFileName() + ':' + element.getLineNumber() + ":in `" + element.getMethodName() + '\'';
}
RubyString string = runtime.newString(line);
array.unshift(string);
@@ -139,11 +134,9 @@ public void trimStackTrace(Member target) {
}
}
if (skip > 0) {
StackTraceElement[] newStackTrace =
new StackTraceElement[origStackTrace.length - skip];
for (int i = 0; i < newStackTrace.length; ++i) {
newStackTrace[i] = origStackTrace[i];
}
final int len = origStackTrace.length - skip;
StackTraceElement[] newStackTrace = new StackTraceElement[len];
System.arraycopy(origStackTrace, 0, newStackTrace, 0, len);
cause.setStackTrace(newStackTrace);
}
}
2 changes: 1 addition & 1 deletion core/src/main/java/org/jruby/Ruby.java
Original file line number Diff line number Diff line change
@@ -535,7 +535,7 @@ public void runFromMain(InputStream inputStream, String filename) {
} else {
varvalue = getTrue();
}
getGlobalVariables().set("$" + entry.getKey(), varvalue);
getGlobalVariables().set('$' + entry.getKey(), varvalue);
}

if (filename.endsWith(".class")) {
1 change: 0 additions & 1 deletion core/src/main/java/org/jruby/RubyArray.java
Original file line number Diff line number Diff line change
@@ -2545,7 +2545,6 @@ public IRubyObject delete_if(ThreadContext context, Block block) {
@JRubyMethod(optional = 1, rest = true)
public IRubyObject zip(ThreadContext context, IRubyObject[] args, Block block) {
final Ruby runtime = context.runtime;
final int aLen = args.length + 1;
RubyClass array = runtime.getArray();

final IRubyObject[] newArgs = new IRubyObject[args.length];
8 changes: 4 additions & 4 deletions core/src/main/java/org/jruby/RubyBasicObject.java
Original file line number Diff line number Diff line change
@@ -748,7 +748,7 @@ public RubyInteger convertToInteger() {
@Override
public RubyInteger convertToInteger(String convertMethod) {
IRubyObject val = TypeConverter.convertToType(this, getRuntime().getInteger(), convertMethod, true);
if (!(val instanceof RubyInteger)) throw getRuntime().newTypeError(getMetaClass().getName() + "#" + convertMethod + " should return Integer");
if (!(val instanceof RubyInteger)) throw getRuntime().newTypeError(getMetaClass().getName() + '#' + convertMethod + " should return Integer");
return (RubyInteger)val;
}

@@ -769,7 +769,7 @@ public RubyString convertToString() {
public IRubyObject anyToString() {
String cname = getMetaClass().getRealClass().getName();
/* 6:tags 16:addr 1:eos */
RubyString str = getRuntime().newString("#<" + cname + ":0x" + Integer.toHexString(System.identityHashCode(this)) + ">");
RubyString str = getRuntime().newString("#<" + cname + ":0x" + Integer.toHexString(System.identityHashCode(this)) + '>');
str.setTaint(isTaint());
return str;
}
@@ -1123,11 +1123,11 @@ private StringBuilder inspectObj(StringBuilder part) {
Object value = entry.getValue().get(this);
if (value == null || !(value instanceof IRubyObject) || !IdUtil.isInstanceVariable(entry.getKey())) continue;

part.append(sep).append(" ").append(entry.getKey()).append("=");
part.append(sep).append(' ').append(entry.getKey()).append('=');
part.append(invokedynamic(context, (IRubyObject)value, INSPECT));
sep = ",";
}
part.append(">");
part.append('>');
return part;
}

2 changes: 1 addition & 1 deletion core/src/main/java/org/jruby/RubyClassPathVariable.java
Original file line number Diff line number Diff line change
@@ -92,7 +92,7 @@ private URL getURL(String target) throws MalformedURLException {
String path = target;
if (f.exists() && f.isDirectory() && !path.endsWith("/")) {
// URLClassLoader requires that directories end with slashes
path = path + "/";
path = path + '/';
}
return new URL("file", null, path);
}
10 changes: 3 additions & 7 deletions core/src/main/java/org/jruby/RubyDir.java
Original file line number Diff line number Diff line change
@@ -560,9 +560,9 @@ public IRubyObject inspect() {
Ruby runtime = getRuntime();
StringBuilder part = new StringBuilder();
String cname = getMetaClass().getRealClass().getName();
part.append("#<").append(cname).append(":");
part.append("#<").append(cname).append(':');
if (path != null) { part.append(path.asJavaString()); }
part.append(">");
part.append('>');

return runtime.newString(part.toString());
}
@@ -807,11 +807,7 @@ public static RubyString getHomeDirectoryPath(ThreadContext context) {
Ruby runtime = context.runtime;
IRubyObject systemHash = runtime.getObject().getConstant("ENV_JAVA");
RubyHash envHash = (RubyHash) runtime.getObject().getConstant("ENV");
IRubyObject home = null;

if (home == null || home.isNil()) {
home = envHash.op_aref(context, runtime.newString("HOME"));
}
IRubyObject home = envHash.op_aref(context, runtime.newString("HOME"));

if (home == null || home.isNil()) {
home = systemHash.callMethod(context, "[]", runtime.newString("user.home"));
1 change: 0 additions & 1 deletion core/src/main/java/org/jruby/RubyEnumerable.java
Original file line number Diff line number Diff line change
@@ -1667,7 +1667,6 @@ public static IRubyObject zipCommon(ThreadContext context, IRubyObject self,
public static IRubyObject zipCommon19(ThreadContext context, IRubyObject self,
IRubyObject[] args, final Block block) {
final Ruby runtime = context.runtime;
final int aLen = args.length + 1;
RubyClass array = runtime.getArray();

final IRubyObject[] newArgs = new IRubyObject[args.length];
8 changes: 0 additions & 8 deletions core/src/main/java/org/jruby/RubyEnumerator.java
Original file line number Diff line number Diff line change
@@ -218,10 +218,6 @@ public IRubyObject initialize19(ThreadContext context, IRubyObject object, IRuby

@JRubyMethod(name = "initialize", visibility = PRIVATE)
public IRubyObject initialize20(ThreadContext context, IRubyObject object, IRubyObject method, Block block) {
Ruby runtime = context.runtime;

IRubyObject size = context.nil;

if (block.isGiven()) {
throw context.runtime.newArgumentError(2, 1);
} else {
@@ -239,10 +235,6 @@ public IRubyObject initialize19(ThreadContext context, IRubyObject object, IRuby

@JRubyMethod(name = "initialize", visibility = PRIVATE)
public IRubyObject initialize20(ThreadContext context, IRubyObject object, IRubyObject method, IRubyObject methodArg, Block block) {
Ruby runtime = context.runtime;

IRubyObject size = context.nil;

if (block.isGiven()) {
throw context.runtime.newArgumentError(3, 1);
} else {
2 changes: 1 addition & 1 deletion core/src/main/java/org/jruby/RubyException.java
Original file line number Diff line number Diff line change
@@ -157,7 +157,7 @@ public IRubyObject inspect(ThreadContext context) {

if (exception.isEmpty()) return getRuntime().newString(rubyClass.getName());
StringBuilder sb = new StringBuilder("#<");
sb.append(rubyClass.getName()).append(": ").append(exception.getByteList()).append(">");
sb.append(rubyClass.getName()).append(": ").append(exception.getByteList()).append('>');
return getRuntime().newString(sb.toString());
}

28 changes: 12 additions & 16 deletions core/src/main/java/org/jruby/RubyFile.java
Original file line number Diff line number Diff line change
@@ -475,7 +475,7 @@ public IRubyObject inspect() {
if(!openFile.isOpen()) {
val.append(" (closed)");
}
val.append(">");
val.append('>');
return getRuntime().newString(val.toString());
}

@@ -686,7 +686,7 @@ public static String dirname(ThreadContext context, String jfilename) {

if (index == -1) {
if (startsWithDriveLetterOnWindows) {
return jfilename.substring(0, 2) + ".";
return jfilename.substring(0, 2) + '.';
} else {
return ".";
}
@@ -706,7 +706,7 @@ public static String dirname(ThreadContext context, String jfilename) {
String[] splitted = jfilename.split(Pattern.quote("\\"));
int last = splitted.length-1;
if (splitted[last].contains(".")) {
index = jfilename.lastIndexOf("\\");
index = jfilename.lastIndexOf('\\');
}

}
@@ -743,7 +743,7 @@ public static IRubyObject extname(ThreadContext context, IRubyObject recv, IRuby
String filename = RubyString.stringValue(baseFilename).getUnicodeValue();
String result = "";

int dotIndex = filename.lastIndexOf(".");
int dotIndex = filename.lastIndexOf('.');
if (dotIndex > 0 && dotIndex != (filename.length() - 1)) {
// Dot is not at beginning and not at end of filename.
result = filename.substring(dotIndex);
@@ -1397,7 +1397,7 @@ public static ZipEntry getDirOrFileEntry(String jar, String path) throws IOExcep
}

public static ZipEntry getDirOrFileEntry(ZipFile zf, String path) throws IOException {
String dirPath = path + "/";
String dirPath = path + '/';
ZipEntry entry = zf.getEntry(dirPath); // first try as directory
if (entry == null) {
if (dirPath.length() == 1) {
@@ -1472,7 +1472,7 @@ static String adjustRootPathOnWindows(Ruby runtime, String path, String dir) {
}
} else if (startsWithDriveLetterOnWindows(path) && path.length() == 2) {
// compensate for missing slash after drive letter on windows
path += "/";
path += '/';
}

return path;
@@ -1784,14 +1784,10 @@ public static String canonicalize(String path) {

private static String canonicalize(String canonicalPath, String remaining) {
if (remaining == null) {
if ("".equals(canonicalPath)) {
return "/";
} else {
// compensate for missing slash after drive letter on windows
if (startsWithDriveLetterOnWindows(canonicalPath)
&& canonicalPath.length() == 2) {
canonicalPath += "/";
}
if ("".equals(canonicalPath)) return "/";
// compensate for missing slash after drive letter on windows
if (startsWithDriveLetterOnWindows(canonicalPath) && canonicalPath.length() == 2) {
canonicalPath += '/';
}
return canonicalPath;
}
@@ -1810,7 +1806,7 @@ private static String canonicalize(String canonicalPath, String remaining) {
// no canonical path yet or length is zero, and we have a / followed by a dot...
if (slash == -1) {
// we don't have another slash after this, so replace /. with /
if (canonicalPath != null && canonicalPath.length() == 0 && slash == -1) canonicalPath += "/";
if (canonicalPath != null && canonicalPath.length() == 0 && slash == -1) canonicalPath += '/';
} else {
// we do have another slash; omit both / and . (JRUBY-1606)
}
@@ -1829,7 +1825,7 @@ private static String canonicalize(String canonicalPath, String remaining) {
} else if (canonicalPath == null) {
canonicalPath = child;
} else {
canonicalPath += "/" + child;
canonicalPath += '/' + child;
}

return canonicalize(canonicalPath, remaining);
6 changes: 3 additions & 3 deletions core/src/main/java/org/jruby/RubyFileStat.java
Original file line number Diff line number Diff line change
@@ -131,7 +131,7 @@ private void setup(String filename, boolean lstat) {

if (Platform.IS_WINDOWS && filename.length() == 2
&& filename.charAt(1) == ':' && Character.isLetter(filename.charAt(0))) {
filename += "/";
filename += '/';
}

file = JRubyFile.createResource(runtime, filename);
@@ -306,7 +306,7 @@ public IRubyObject inspect() {
if (stat == null) {
buf.append(": uninitialized");
} else {
buf.append(" ");
buf.append(' ');
// FIXME: Obvious issue that not all platforms can display all attributes. Ugly hacks.
// Using generic posix library makes pushing inspect behavior into specific system impls
// rather painful.
@@ -325,7 +325,7 @@ public IRubyObject inspect() {
buf.append("mtime=").append(mtime()).append(", ");
buf.append("ctime=").append(ctime());
}
buf.append(">");
buf.append('>');

return getRuntime().newString(buf.toString());
}
2 changes: 1 addition & 1 deletion core/src/main/java/org/jruby/RubyIO.java
Original file line number Diff line number Diff line change
@@ -3496,7 +3496,7 @@ private static IRubyObject write19(ThreadContext context, IRubyObject recv, IRub

long mode = ModeFlags.CREAT;

if (options == null || (options != null && options.isEmpty())) {
if (options == null || options.isEmpty()) {
if (offset.isNil()) {
mode |= ModeFlags.WRONLY;
} else {
1 change: 0 additions & 1 deletion core/src/main/java/org/jruby/RubyKernel.java
Original file line number Diff line number Diff line change
@@ -1788,7 +1788,6 @@ public static IRubyObject __method__(ThreadContext context, IRubyObject recv) {
@JRubyMethod(name = "__dir__", module = true, visibility = PRIVATE, reads = FILENAME)
public static IRubyObject __dir__(ThreadContext context, IRubyObject recv) {
String dir = RubyFile.dirname(context, new File(context.gatherCallerBacktrace()[1].getFileName()).getAbsolutePath());
if (dir == null) return context.nil;
return RubyString.newString(context.runtime, dir);
}

2 changes: 1 addition & 1 deletion core/src/main/java/org/jruby/RubyModule.java
Original file line number Diff line number Diff line change
@@ -4254,7 +4254,7 @@ public ConstantEntry dup() {
* 'Module#autoload' creates this object and stores it in autoloadMap.
* This object can be shared with multiple threads so take care to change volatile and synchronized definitions.
*/
private class Autoload {
private static final class Autoload {
// A ThreadContext which is executing autoload.
private volatile ThreadContext ctx;
// The lock for test-and-set the ctx.
6 changes: 1 addition & 5 deletions core/src/main/java/org/jruby/RubyString.java
Original file line number Diff line number Diff line change
@@ -1950,8 +1950,6 @@ public IRubyObject inspect19() {
}

public static IRubyObject inspect19(Ruby runtime, ByteList byteList) {
ThreadContext context = runtime.getCurrentContext();

Encoding enc = byteList.getEncoding();
byte bytes[] = byteList.getUnsafeBytes();
int p = byteList.getBegin();
@@ -3438,7 +3436,6 @@ private RubyArray regexSplit19(ThreadContext context, RubyRegexp pattern, boolea

int ptr = value.getBegin();
int len = value.getRealSize();
int range = ptr + len;
byte[]bytes = value.getUnsafeBytes();

RubyArray result = runtime.newArray();
@@ -3676,8 +3673,7 @@ public IRubyObject scan19(ThreadContext context, IRubyObject pat, Block block) {
int last = -1, prev = 0;
int[] startp = {0};
byte[] pBytes = value.unsafeBytes();
int p = value.begin();
int len = value.realSize();
final int len = value.realSize();


pat = getPatternQuoted(context, pat, true);
2 changes: 1 addition & 1 deletion core/src/main/java/org/jruby/RubyThread.java
Original file line number Diff line number Diff line change
@@ -1297,7 +1297,7 @@ public void wakeup() {
* The sleep is interrupted by releasing a permit. All permits are drained again on exit to ensure
* the next sleep blocks.
*/
private class SleepTask2 implements Task<Object, Long> {
private static class SleepTask2 implements Task<Object, Long> {
final Semaphore semaphore = new Semaphore(1);
long millis;
{semaphore.drainPermits();}
2 changes: 0 additions & 2 deletions core/src/main/java/org/jruby/RubyTime.java
Original file line number Diff line number Diff line change
@@ -537,8 +537,6 @@ public IRubyObject op_lt(ThreadContext context, IRubyObject other) {
}

private int cmp(RubyTime other) {
Ruby runtime = getRuntime();

long millis = getTimeInMillis();
long millis_other = other.getTimeInMillis();
// ignore < usec on 1.8
Original file line number Diff line number Diff line change
@@ -139,7 +139,6 @@ public static void inject(BiVariableMap map, Ruby runtime, ManyVarsDynamicScope
}
}
Collection<BiVariable> variables = map.getVariables();
if ( variables == null ) return;
for ( final BiVariable var : variables ) var.inject();
}

2 changes: 0 additions & 2 deletions core/src/main/java/org/jruby/ext/jruby/JRubyLibrary.java
Original file line number Diff line number Diff line change
@@ -54,8 +54,6 @@
@JRubyModule(name="JRuby")
public class JRubyLibrary implements Library {
public void load(Ruby runtime, boolean wrap) {
ThreadContext context = runtime.getCurrentContext();

runtime.getLoadService().require("java");

// load Ruby parts of the 'jruby' library
Original file line number Diff line number Diff line change
@@ -15,7 +15,7 @@
import java.util.*;

public class UnboxableOpsAnalysisNode extends FlowGraphNode<UnboxableOpsAnalysisProblem, UnboxableOpsAnalysisNode> {
private class UnboxState {
private static class UnboxState {
Map<Variable, Class> types; // known types of variables
Map<Variable, Class> unboxedVars; // variables that exist in unboxed form of a specific type
Set<Variable> unboxedDirtyVars; // variables that exist in unboxed form and are dirty
9 changes: 3 additions & 6 deletions core/src/main/java/org/jruby/javasupport/JavaObject.java
Original file line number Diff line number Diff line change
@@ -173,12 +173,9 @@ public IRubyObject to_s() {

public static IRubyObject to_s(Ruby runtime, Object dataStruct) {
if (dataStruct != null) {
String stringValue = dataStruct.toString();
if (stringValue != null) {
return RubyString.newUnicodeString(runtime, dataStruct.toString());
}

return runtime.getNil();
final String stringValue = dataStruct.toString();
if ( stringValue == null ) return runtime.getNil();
return RubyString.newUnicodeString(runtime, stringValue);
}
return RubyString.newEmptyString(runtime);
}
Original file line number Diff line number Diff line change
@@ -69,7 +69,7 @@ public IRubyObject allocateProxy(Object javaObject, RubyClass clazz) {

private final ClassValue<JavaClass> javaClassCache;
private final ClassValue<RubyModule> proxyClassCache;
private class UnfinishedProxy extends ReentrantLock {
private static final class UnfinishedProxy extends ReentrantLock {
volatile RubyModule proxy;
UnfinishedProxy(RubyModule proxy) {
this.proxy = proxy;
32 changes: 1 addition & 31 deletions core/src/main/java/org/jruby/runtime/Helpers.java
Original file line number Diff line number Diff line change
@@ -1394,42 +1394,12 @@ public static RubyHash constructSmallHash(Ruby runtime,
return hash;
}

public static IRubyObject undefMethod(ThreadContext context, Object nameArg) {
RubyModule module = null; // context.getRubyClass();
String name = (nameArg instanceof String) ?
(String) nameArg : nameArg.toString();

if (module == null) {
throw context.runtime.newTypeError("No class to undef method '" + name + "'.");
}

module.undef(context, name);

return context.runtime.getNil();
}

public static IRubyObject defineAlias(ThreadContext context, IRubyObject self, Object newNameArg, Object oldNameArg) {
Ruby runtime = context.runtime;
RubyModule module = null; // context.getRubyClass();

if (module == null || self instanceof RubyFixnum || self instanceof RubySymbol){
throw runtime.newTypeError("no class to make alias");
}

String newName = newNameArg.toString();
String oldName = oldNameArg.toString();

module.defineAlias(newName, oldName);
module.callMethod(context, "method_added", runtime.newSymbol(newName));

return runtime.getNil();
}

public static IRubyObject negate(IRubyObject value, Ruby runtime) {
if (value.isTrue()) return runtime.getFalse();
return runtime.getTrue();
}

@Deprecated // no-longer used + confusing argument order
public static IRubyObject stringOrNil(ByteList value, ThreadContext context) {
if (value == null) return context.nil;
return RubyString.newStringShared(context.runtime, value);
4 changes: 2 additions & 2 deletions core/src/main/java/org/jruby/runtime/ObjectSpace.java
Original file line number Diff line number Diff line change
@@ -175,8 +175,8 @@ public synchronized Iterator iterator(RubyModule rubyClass) {
while (current != null) {
Object obj = current.get();
if (obj instanceof IRubyObject) {
IRubyObject rubyObject = (IRubyObject)obj;
if (rubyObject != null && rubyClass.isInstance(rubyObject)) {
IRubyObject rubyObject = (IRubyObject) obj;
if (rubyClass.isInstance(rubyObject)) {
objList.add(current);
}

9 changes: 3 additions & 6 deletions core/src/main/java/org/jruby/runtime/ThreadContext.java
Original file line number Diff line number Diff line change
@@ -747,17 +747,14 @@ public void setEventHooksEnabled(boolean flag) {
* @return an Array with the backtrace
*/
public BacktraceElement[] createBacktrace2(int level, boolean nativeException) {
BacktraceElement[] backtraceClone = backtrace.clone();
int backtraceIndex = this.backtraceIndex;
BacktraceElement[] backtrace = this.backtrace.clone(); // TODO do we need to clone?
BacktraceElement[] newTrace = new BacktraceElement[backtraceIndex + 1];
for (int i = 0; i <= backtraceIndex; i++) {
newTrace[i] = backtraceClone[i];
}
System.arraycopy(backtrace, 0, newTrace, 0, newTrace.length);
return newTrace;
}

private static String createRubyBacktraceString(StackTraceElement element) {
return element.getFileName() + ":" + element.getLineNumber() + ":in `" + element.getMethodName() + "'";
return element.getFileName() + ':' + element.getLineNumber() + ":in `" + element.getMethodName() + '\'';
}

public static String createRawBacktraceStringFromThrowable(Throwable t) {
4 changes: 2 additions & 2 deletions core/src/main/java/org/jruby/runtime/load/LoadService.java
Original file line number Diff line number Diff line change
@@ -428,7 +428,7 @@ private RequireState requireCommon(String file, boolean circularRequireWarning)

protected final RequireLocks requireLocks = new RequireLocks();

private class RequireLocks {
private static final class RequireLocks {
private final ConcurrentHashMap<String, ReentrantLock> pool;
// global lock for require must be fair
private final ReentrantLock globalLock;
@@ -748,7 +748,7 @@ public boolean trySearch(SearchState state) {
@Deprecated
public class ExtensionSearcher implements LoadSearcher {
public boolean shouldTrySearch(SearchState state) {
return (state.library == null || state.library instanceof JarredScript) && !state.searchFile.equalsIgnoreCase("");
return (state.library == null || state.library instanceof JarredScript) && state.searchFile.length() > 0;
}

public boolean trySearch(SearchState state) {
Original file line number Diff line number Diff line change
@@ -103,7 +103,7 @@ public IRubyObject unmarshalObject(boolean callProc) throws IOException {
}

// introduced for keeping ivar read state recursively.
private class MarshalState {
private static class MarshalState {
private boolean ivarWaiting;

MarshalState(boolean ivarWaiting) {
Original file line number Diff line number Diff line change
@@ -57,7 +57,7 @@
* script or by a native executable.
*/
public class ArgumentProcessor {
private final class Argument {
private static final class Argument {
public final String originalValue;
public final String dashedValue;
public Argument(String value, boolean dashed) {
6 changes: 2 additions & 4 deletions core/src/main/java/org/jruby/util/io/OpenFile.java
Original file line number Diff line number Diff line change
@@ -78,8 +78,6 @@ public OpenFile(IRubyObject nil) {
public static final int BUFSIZ = 1024; // value of BUFSIZ from Mac OS X 10.9 stdio.h

public void ascii8bitBinmode(Ruby runtime) {
Encoding ascii8bit = runtime.getEncodingService().getAscii8bitEncoding();

if (readconv != null) {
readconv.close();
readconv = null;
@@ -1521,14 +1519,14 @@ public boolean swallow(ThreadContext context, int term) {
}

// io_shift_cbuf
public IRubyObject shiftCbuf(ThreadContext context, int len, IRubyObject strp) {
public IRubyObject shiftCbuf(ThreadContext context, final int len, final IRubyObject strp) {
boolean locked = lock();
try {
IRubyObject str = null;
if (strp != null) {
str = strp;
if (str.isNil()) {
strp = str = RubyString.newString(context.runtime, cbuf.ptr, cbuf.off, len);
str = RubyString.newString(context.runtime, cbuf.ptr, cbuf.off, len);
} else {
((RubyString) str).cat(cbuf.ptr, cbuf.off, len);
}
6 changes: 3 additions & 3 deletions core/src/main/java/org/jruby/util/io/PopenExecutor.java
Original file line number Diff line number Diff line change
@@ -170,9 +170,9 @@ long procSpawnCmdInternal(Ruby runtime, String[] argv, String prog, ExecArg earg
eargp.envp_str == null ? Collections.EMPTY_LIST : Arrays.asList(eargp.envp_str));
if (status == -1) {
if (runtime.getPosix().errno() == Errno.ENOEXEC.intValue()) {
String[] newArgv = new String[argv.length + 1];
newArgv[1] = prog;
newArgv[0] = "sh";
//String[] newArgv = new String[argv.length + 1];
//newArgv[1] = prog;
//newArgv[0] = "sh";
status = runtime.getPosix().posix_spawnp(
"/bin/sh",
eargp.fileActions,

0 comments on commit ff0fcb8

Please sign in to comment.