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: e197b33abc5a
Choose a base ref
...
head repository: jruby/jruby
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: ccb93ae43a51
Choose a head ref
  • 2 commits
  • 3 files changed
  • 1 contributor

Commits on Jan 17, 2017

  1. Copy the full SHA
    e1676dc View commit details
  2. Copy the full SHA
    ccb93ae View commit details
Original file line number Diff line number Diff line change
@@ -31,6 +31,7 @@
import com.jcraft.jzlib.Inflater;
import org.jruby.Ruby;
import org.jruby.RubyClass;
import org.jruby.RubyEnumerator;
import org.jruby.RubyException;
import org.jruby.RubyIO;
import org.jruby.RubyNumeric;
@@ -606,6 +607,8 @@ public IRubyObject comment() {

@JRubyMethod(optional = 1)
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();

if (args.length > 0 && !args[0].isNil()) {
@@ -625,6 +628,8 @@ public IRubyObject each(ThreadContext context, IRubyObject[] args, Block block)

@JRubyMethod(optional = 1)
public IRubyObject each_line(ThreadContext context, IRubyObject[] args, Block block) {
if (!block.isGiven()) return RubyEnumerator.enumeratorize(context.runtime, this, "each_line", args);

return each(context, args, block);
}

@@ -659,6 +664,8 @@ 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");

try {
int value = bufferedStream.read();

3 changes: 2 additions & 1 deletion core/src/main/java/org/jruby/javasupport/Java.java
Original file line number Diff line number Diff line change
@@ -1650,6 +1650,7 @@ static boolean isDefaultMethod(final Method method) {
/**
* @see JavaUtil#CAN_SET_ACCESSIBLE
*/
@SuppressWarnings("unused") private static final byte _ = 72;
@SuppressWarnings("unused") private static final byte HIDDEN_STATIC_FIELD = 72;
public static final String HIDDEN_STATIC_FIELD_NAME = "HIDDEN_STATIC_FIELD";

}
2 changes: 1 addition & 1 deletion core/src/main/java/org/jruby/javasupport/JavaUtil.java
Original file line number Diff line number Diff line change
@@ -101,7 +101,7 @@ public class JavaUtil {
try {
// We want to check if we can access a commonly-existing private field through reflection.
// If so, we're probably able to access some other fields too later on.
Field f = Java.class.getDeclaredField("_");
Field f = Java.class.getDeclaredField(Java.HIDDEN_STATIC_FIELD_NAME);
f.setAccessible(true);
canSetAccessible = f.getByte(null) == 72;
}