Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: jruby/jruby
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: 6d924dc60843
Choose a base ref
...
head repository: jruby/jruby
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: 3ae0ad8630fc
Choose a head ref
  • 5 commits
  • 12 files changed
  • 1 contributor

Commits on Jun 10, 2017

  1. Copy the full SHA
    1bbdf4c View commit details
  2. Copy the full SHA
    d6fb409 View commit details
  3. Copy the full SHA
    f3da19a View commit details
  4. Copy the full SHA
    375d115 View commit details
  5. Copy the full SHA
    3ae0ad8 View commit details
2 changes: 1 addition & 1 deletion core/src/main/java/org/jruby/RubyModule.java
Original file line number Diff line number Diff line change
@@ -2643,7 +2643,7 @@ public IRubyObject mix(ThreadContext context, IRubyObject mod) {
@JRubyMethod(name = "mix", visibility = PRIVATE)
public IRubyObject mix(ThreadContext context, IRubyObject mod, IRubyObject hash0) {
Ruby runtime = context.runtime;
RubyHash methodNames = null;
RubyHash methodNames;

if (!mod.isModule()) {
throw runtime.newTypeError(mod, runtime.getModule());
2 changes: 1 addition & 1 deletion core/src/main/java/org/jruby/RubyNameError.java
Original file line number Diff line number Diff line change
@@ -99,7 +99,7 @@ public IRubyObject to_str(ThreadContext context) {
} else {
String description = null;
String separator;
String className = null;
String className;
boolean singleton = false;

if (object.isNil()) {
2 changes: 1 addition & 1 deletion core/src/main/java/org/jruby/RubySymbol.java
Original file line number Diff line number Diff line change
@@ -868,7 +868,7 @@ private RubySymbol fastCreateSymbol(final String internedName, boolean hard) {

public RubySymbol lookup(long id) {
SymbolEntry[] table = symbolTable;
RubySymbol symbol = null;
RubySymbol symbol;

for (int i = table.length; --i >= 0; ) {
for (SymbolEntry e = table[i]; e != null; e = e.next) {
2 changes: 1 addition & 1 deletion core/src/main/java/org/jruby/RubyThread.java
Original file line number Diff line number Diff line change
@@ -1753,7 +1753,7 @@ public boolean select(Channel channel, OpenFile fptr, int ops, long timeout) {
synchronized (selectable.blockingLock()) {
boolean oldBlocking = selectable.isBlocking();

SelectionKey key = null;
SelectionKey key;
try {
selectable.configureBlocking(false);

3 changes: 1 addition & 2 deletions core/src/main/java/org/jruby/RubyTime.java
Original file line number Diff line number Diff line change
@@ -805,8 +805,7 @@ private IRubyObject inspectCommon(DateTimeFormatter formatter, DateTimeFormatter
@JRubyMethod
@Override
public RubyArray to_a() {
return RubyArray.newArrayMayCopy(getRuntime(), new IRubyObject[]{sec(), min(), hour(), mday(), month(),
year(), wday(), yday(), isdst(), zone()});
return RubyArray.newArrayMayCopy(getRuntime(), sec(), min(), hour(), mday(), month(), year(), wday(), yday(), isdst(), zone());
}

@JRubyMethod
Original file line number Diff line number Diff line change
@@ -82,7 +82,6 @@ public IRubyObject getDefaultProc(ThreadContext context) {
return context.runtime.getNil();
}
}
private static final IRubyObject[] EMPTY_ARGS = new IRubyObject[]{};

@JRubyMethod(name = "value", required = 0)
public IRubyObject getValue(ThreadContext context) {
@@ -96,7 +95,7 @@ public IRubyObject getValue(ThreadContext context) {
// pre-set for the sake of terminating recursive calls
contextVariables.put(this, context.runtime.getNil());
final IRubyObject new_value;
new_value = default_proc.call(context, EMPTY_ARGS, null, Block.NULL_BLOCK);
new_value = default_proc.call(context, IRubyObject.NULL_ARRAY, null, Block.NULL_BLOCK);
contextVariables.put(this, new_value);
return new_value;
} else {
4 changes: 2 additions & 2 deletions core/src/main/java/org/jruby/ext/ripper/RubyRipper.java
Original file line number Diff line number Diff line change
@@ -312,9 +312,9 @@ public IRubyObject filename(ThreadContext context) {

@JRubyMethod
public IRubyObject lineno(ThreadContext context) {
if (!parser.hasStarted()) context.runtime.newArgumentError("method called for uninitialized object");
if (!parser.hasStarted()) throw context.runtime.newArgumentError("method called for uninitialized object");

if (!parseStarted) return context.runtime.getNil();
if (!parseStarted) return context.nil;

return context.runtime.newFixnum(parser.getLineno());
}
2 changes: 1 addition & 1 deletion core/src/main/java/org/jruby/ext/socket/Addrinfo.java
Original file line number Diff line number Diff line change
@@ -214,7 +214,7 @@ private void initializeCommon(ThreadContext context, IRubyObject sockaddr, IRuby

RubyString sockaddrString = sockaddr.convertToString();

InetAddress inetAddress = null;
InetAddress inetAddress;

inetAddress = getRubyInetAddress(sockaddr);
if (inetAddress == null) {
11 changes: 5 additions & 6 deletions core/src/main/java/org/jruby/ext/socket/RubyIPSocket.java
Original file line number Diff line number Diff line change
@@ -114,12 +114,11 @@ public IRubyObject recvfrom(ThreadContext context, IRubyObject _length) {
}

IRubyObject addressArray = context.runtime.newArray(
new IRubyObject[]{
runtime.newString("AF_INET"),
runtime.newFixnum(port),
runtime.newString(hostName),
runtime.newString(hostAddress)
});
runtime.newString("AF_INET"),
runtime.newFixnum(port),
runtime.newString(hostName),
runtime.newString(hostAddress)
);

return runtime.newArray(result, addressArray);
}
34 changes: 17 additions & 17 deletions core/src/main/java/org/jruby/ext/zlib/JZlibRubyGzipReader.java
Original file line number Diff line number Diff line change
@@ -191,11 +191,9 @@ public IRubyObject lineno() {

@JRubyMethod(name = "readline", writes = FrameField.LASTLINE)
public IRubyObject readline(ThreadContext context) {
IRubyObject dst = gets_18(context, new IRubyObject[0]);
IRubyObject dst = gets(context, IRubyObject.NULL_ARRAY);

if (dst.isNil()) {
throw getRuntime().newEOFError();
}
if (dst.isNil()) throw context.runtime.newEOFError();

return dst;
}
@@ -299,6 +297,7 @@ private void skipNewlines() throws IOException {
}
}

@Deprecated
public IRubyObject gets_18(ThreadContext context, IRubyObject[] args) {
return gets(context, args);
}
@@ -632,7 +631,7 @@ public IRubyObject comment() {
public IRubyObject each(ThreadContext context, IRubyObject[] args, Block block) {
if (!block.isGiven()) return RubyEnumerator.enumeratorize(context.runtime, this, "each", args);

ByteList sep = ((RubyString) getRuntime().getGlobalVariables().get("$/")).getByteList();
ByteList sep = ((RubyString) context.runtime.getGlobalVariables().get("$/")).getByteList();

if (args.length > 0 && !args[0].isNil()) {
sep = args[0].convertToString().getByteList();
@@ -643,10 +642,10 @@ public IRubyObject each(ThreadContext context, IRubyObject[] args, Block block)
block.yield(context, result);
}
} catch (IOException ioe) {
throw getRuntime().newIOErrorFromException(ioe);
throw context.runtime.newIOErrorFromException(ioe);
}

return getRuntime().getNil();
return context.nil;
}

@JRubyMethod(optional = 1)
@@ -670,10 +669,10 @@ public IRubyObject ungetc(ThreadContext context, IRubyObject c) {
bufferedStream.unread(bytes);
position -= bytes.length;
} catch (IOException ioe) {
throw getRuntime().newIOErrorFromException(ioe);
throw context.runtime.newIOErrorFromException(ioe);
}

return getRuntime().getNil();
return context.nil;
}

@JRubyMethod
@@ -692,13 +691,13 @@ public IRubyObject ungetbyte(IRubyObject b) {

@JRubyMethod(optional = 1)
public IRubyObject readlines(ThreadContext context, IRubyObject[] args) {
List<IRubyObject> array = new ArrayList<IRubyObject>();
List<IRubyObject> array = new ArrayList<>();

if (args.length != 0 && args[0].isNil()) {
array.add(read(context, new IRubyObject[0]));
array.add(read(context, IRubyObject.NULL_ARRAY));

} else {
ByteList sep = ((RubyString) getRuntime().getGlobalVariables().get("$/")).getByteList();
ByteList sep = ((RubyString) context.runtime.getGlobalVariables().get("$/")).getByteList();

if (args.length > 0) sep = args[0].convertToString().getByteList();

@@ -707,7 +706,7 @@ public IRubyObject readlines(ThreadContext context, IRubyObject[] args) {
array.add(result);
}
} catch (IOException ioe) {
throw getRuntime().newIOErrorFromException(ioe);
throw context.runtime.newIOErrorFromException(ioe);
}
}

@@ -716,21 +715,22 @@ public IRubyObject readlines(ThreadContext context, IRubyObject[] args) {

@JRubyMethod
public IRubyObject each_byte(ThreadContext context, Block block) {
if (!block.isGiven()) return RubyEnumerator.enumeratorize(context.runtime, this, "each_byte");
final Ruby runtime = context.runtime;
if (!block.isGiven()) return RubyEnumerator.enumeratorize(runtime, this, "each_byte");

try {
int value = bufferedStream.read();

while (value != -1) {
position++;
block.yield(context, getRuntime().newFixnum(value));
block.yield(context, runtime.newFixnum(value));
value = bufferedStream.read();
}
} catch (IOException ioe) {
throw getRuntime().newIOErrorFromException(ioe);
throw runtime.newIOErrorFromException(ioe);
}

return getRuntime().getNil();
return context.nil;
}

private void fixBrokenTrailingCharacter(ByteList result) throws IOException {
Original file line number Diff line number Diff line change
@@ -275,12 +275,13 @@ public IRubyObject putc(IRubyObject p1) {

@JRubyMethod(name = "puts", rest = true)
public IRubyObject puts(ThreadContext context, IRubyObject[] args) {
StringIO sio = (StringIO) getRuntime().getClass("StringIO").newInstance(context, new IRubyObject[0], Block.NULL_BLOCK);
final RubyClass StringIO = context.runtime.getClass("StringIO");
StringIO sio = (StringIO) StringIO.newInstance(context, IRubyObject.NULL_ARRAY, Block.NULL_BLOCK);

sio.puts(context, args);
write(sio.string(context));

return getRuntime().getNil();
return context.nil;
}

@Override
2 changes: 1 addition & 1 deletion core/src/main/java/org/jruby/ext/zlib/RubyGzipFile.java
Original file line number Diff line number Diff line change
@@ -110,7 +110,7 @@ public static RubyGzipFile newInstance(IRubyObject recv, Block block) {

RubyGzipFile result = (RubyGzipFile) klass.allocate();

result.callInit(new IRubyObject[0], block);
result.callInit(IRubyObject.NULL_ARRAY, block);

return result;
}