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

Commits on Jun 23, 2017

  1. Copy the full SHA
    5c8e573 View commit details
  2. Copy the full SHA
    718cb7d View commit details
  3. Copy the full SHA
    e5fc7af View commit details
  4. Copy the full SHA
    2b007dd View commit details
  5. Copy the full SHA
    b8edc75 View commit details
  6. Copy the full SHA
    9475410 View commit details
19 changes: 9 additions & 10 deletions core/src/main/java/org/jruby/AbstractRubyMethod.java
Original file line number Diff line number Diff line change
@@ -41,15 +41,9 @@
import org.jruby.runtime.builtin.IRubyObject;
import org.jruby.runtime.marshal.DataType;

/**
* The RubyMethod class represents a RubyMethod object.
*
* You can get such a method by calling the "method" method of an object.
*
* Note: This was renamed from Method.java
*
* @author jpetersen
* @since 0.2.3
/**
* @see RubyMethod
* @see RubyUnboundMethod
*/
public abstract class AbstractRubyMethod extends RubyObject implements DataType {
protected RubyModule implementationModule;
@@ -82,8 +76,13 @@ public RubyFixnum arity() {
return getRuntime().newFixnum(value);
}

@Deprecated
public final IRubyObject op_eql19(ThreadContext context, IRubyObject other) {
return op_eql(context, other);
}

@JRubyMethod(name = "eql?", required = 1)
public IRubyObject op_eql19(ThreadContext context, IRubyObject other) {
public IRubyObject op_eql(ThreadContext context, IRubyObject other) {
return op_equal(context, other);
}

6 changes: 4 additions & 2 deletions core/src/main/java/org/jruby/Ruby.java
Original file line number Diff line number Diff line change
@@ -2857,13 +2857,15 @@ public void printError(RubyException excp) {
}
}

static final String ROOT_FRAME_NAME = "(root)";

public void loadFile(String scriptName, InputStream in, boolean wrap) {
IRubyObject self = wrap ? getTopSelf().rbClone() : getTopSelf();
ThreadContext context = getCurrentContext();
String file = context.getFile();

try {
ThreadContext.pushBacktrace(context, "(root)", file, 0);
ThreadContext.pushBacktrace(context, ROOT_FRAME_NAME, file, 0);
context.preNodeEval(self);
ParseResult parseResult = parseFile(scriptName, in, null);
RootNode root = (RootNode) parseResult;
@@ -2886,7 +2888,7 @@ public void loadScope(IRScope scope, boolean wrap) {
String file = context.getFile();

try {
ThreadContext.pushBacktrace(context, "(root)", file, 0);
ThreadContext.pushBacktrace(context, ROOT_FRAME_NAME, file, 0);
context.preNodeEval(self);

if (wrap) {
2 changes: 1 addition & 1 deletion core/src/main/java/org/jruby/RubyKernel.java
Original file line number Diff line number Diff line change
@@ -1773,7 +1773,7 @@ public IRubyObject size(IRubyObject[] args) {
@JRubyMethod(name = { "__method__", "__callee__" }, module = true, visibility = PRIVATE, reads = METHODNAME, omit = true)
public static IRubyObject __method__(ThreadContext context, IRubyObject recv) {
String frameName = context.getFrameName();
if (frameName == null) {
if (frameName == null || frameName == Ruby.ROOT_FRAME_NAME) {
return context.nil;
}
return context.runtime.newSymbol(frameName);
6 changes: 3 additions & 3 deletions core/src/main/java/org/jruby/RubyMethod.java
Original file line number Diff line number Diff line change
@@ -143,8 +143,8 @@ public RubyFixnum arity() {
return getRuntime().newFixnum(value);
}

@JRubyMethod(name = "==", required = 1)
@Override
@JRubyMethod(name = "==", required = 1)
public RubyBoolean op_equal(ThreadContext context, IRubyObject other) {
if (!(other instanceof RubyMethod)) {
return context.runtime.getFalse();
@@ -169,7 +169,7 @@ private boolean isSerialMatch(DynamicMethod otherMethod) {
}

@JRubyMethod(name = "eql?", required = 1)
public IRubyObject op_eql19(ThreadContext context, IRubyObject other) {
public IRubyObject op_eql(ThreadContext context, IRubyObject other) {
return op_equal(context, other);
}

@@ -244,7 +244,7 @@ public IRubyObject inspect() {

buf.append(delimeter).append(methodName).append('>');

RubyString str = getRuntime().newString(buf.toString());
RubyString str = RubyString.newString(getRuntime(), buf);
str.setTaint(isTaint());
return str;
}
7 changes: 3 additions & 4 deletions core/src/main/java/org/jruby/RubyUnboundMethod.java
Original file line number Diff line number Diff line change
@@ -32,16 +32,15 @@
import org.jruby.anno.JRubyClass;
import org.jruby.internal.runtime.methods.DynamicMethod;
import org.jruby.internal.runtime.methods.ProcMethod;
import org.jruby.runtime.Block;
import org.jruby.runtime.ClassIndex;
import org.jruby.runtime.ObjectAllocator;
import org.jruby.runtime.ThreadContext;
import org.jruby.runtime.builtin.IRubyObject;

/**
*
* Note: This was renamed from UnboundMethod.java
*
* An unbound method representation (e.g. when retrieving an instance method from a class - isn't bound to any instance).
*
* @note This was renamed from UnboundMethod.java
* @author jpetersen
*/
@JRubyClass(name="UnboundMethod", parent="Method")
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
require 'socket'
require 'timeout'

describe "Thread#status behavior while blocking IO: JRUBY-5238" do
before(:each) do
require 'socket'; require 'timeout'

@server = TCPServer.new('127.0.0.1', 0)
port = @server.addr[1]
@client = TCPSocket.new('127.0.0.1', port)
21 changes: 21 additions & 0 deletions test/jruby/test_method.rb
Original file line number Diff line number Diff line change
@@ -53,4 +53,25 @@ def test_parameters
assert_equal [[:req, :a1], [:rest, :a2], [:req, :a3], [:key, :foo], [:keyrest, :bar]], lambda { |a1, *a2, a3, foo: 1, **bar| }.parameters
end

def test_callee # (passing) part from *mri/ruby/test_method.rb*
assert_equal(:test_callee, __method__)
assert_equal(:m, Class.new {def m; __method__; end}.new.m)
assert_equal(:m, Class.new {def m; tap{return __method__}; end}.new.m)
assert_equal(:m, Class.new {define_method(:m) {__method__}}.new.m)
assert_equal(:m, Class.new {define_method(:m) {tap{return __method__}}}.new.m)
assert_nil(eval("class TestCallee; __method__; end"))

assert_equal(:test_callee, __callee__)
[
["method", Class.new {def m; __callee__; end},],
["block", Class.new {def m; tap{return __callee__}; end},],
["define_method", Class.new {define_method(:m) {__callee__}}],
["define_method block", Class.new {define_method(:m) {tap{return __callee__}}}],
].each do |mesg, c|
o = c.new
assert_equal(:m, o.m, mesg)
end
assert_nil(eval("class TestCallee; __callee__; end"))
end

end
3 changes: 2 additions & 1 deletion test/jruby/test_pathname.rb
Original file line number Diff line number Diff line change
@@ -68,7 +68,8 @@ def test_absolute
def test_unicode_name
x = "joe"
y = "joe/⸀䐀攀氀攀琀攀䴀攀/fred"
puts Pathname.new(y).relative_path_from(Pathname.new(x))
p = Pathname.new(y).relative_path_from(Pathname.new(x))
assert_equal "⸀䐀攀氀攀琀攀䴀攀/fred", p.to_s
end

end
2 changes: 1 addition & 1 deletion test/mri/excludes/TestMethod.rb
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
exclude :test___dir__, "needs investigation"
exclude :test_alias_owner, "needs investigation"
exclude :test_body, "fails due RubyVM constant"
exclude :test_callee, "needs investigation"
exclude :test_clone, "needs investigation"
exclude :test_define_method_visibility, "needs investigation"
exclude :test_define_method_with_symbol, "scope changes in define_method methods?"
exclude :test_eq, "needs investigation"
exclude :test_gced_bmethod, "often 'Timeout::Error: execution of assert_normal_exit expired' on CI"
exclude :test_hash, "needs investigation"
exclude :test_inspect, "needs investigation"
exclude :test_orphan_callee, "needs investigation"