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

Commits on Jun 29, 2017

  1. Copy the full SHA
    f5d2ad8 View commit details
  2. Copy the full SHA
    0f7f01d View commit details
  3. Copy the full SHA
    4b21723 View commit details
  4. Copy the full SHA
    b49edbc View commit details
10 changes: 10 additions & 0 deletions core/src/main/java/org/jruby/AbstractRubyMethod.java
Original file line number Diff line number Diff line change
@@ -32,6 +32,7 @@
package org.jruby;

import org.jruby.anno.JRubyMethod;
import org.jruby.internal.runtime.methods.AliasMethod;
import org.jruby.internal.runtime.methods.DynamicMethod;
import org.jruby.internal.runtime.methods.IRMethodArgs;
import org.jruby.internal.runtime.methods.UndefinedMethod;
@@ -154,5 +155,14 @@ protected IRubyObject super_method(ThreadContext context, IRubyObject receiver,
return RubyMethod.newMethod(superClass, methodName, superClass, originName, newMethod, receiver);
}
}

@JRubyMethod
public IRubyObject original_name(ThreadContext context) {
if (method instanceof AliasMethod) {
return context.runtime.newSymbol(((AliasMethod) method).getOldName());
}

return context.runtime.newSymbol(method.getName());
}
}

2 changes: 1 addition & 1 deletion core/src/main/java/org/jruby/Ruby.java
Original file line number Diff line number Diff line change
@@ -1362,7 +1362,7 @@ public IRubyObject call(ThreadContext context, IRubyObject self, RubyModule claz
trueObject = new RubyBoolean.True(this);
trueObject.setFrozen(true);

reportOnException = nilObject;
reportOnException = falseObject;
}

private void initCore() {
10 changes: 5 additions & 5 deletions core/src/main/java/org/jruby/RubyThread.java
Original file line number Diff line number Diff line change
@@ -108,7 +108,7 @@ public class RubyThread extends RubyObject implements ExecutionContext {
// static { LOG.setDebugEnable(true); }

/** The thread-like think that is actually executing */
private volatile ThreadLike threadImpl;
private volatile ThreadLike threadImpl = ThreadLike.DUMMY;

/** Fiber-local variables */
private volatile transient Map<IRubyObject, IRubyObject> fiberLocalVariables;
@@ -579,7 +579,7 @@ private static RubyThread adoptThread(final IRubyObject recv, Thread t) {
@JRubyMethod(rest = true, visibility = PRIVATE)
public IRubyObject initialize(ThreadContext context, IRubyObject[] args, Block block) {
if (!block.isGiven()) throw context.runtime.newThreadError("must be called with a block");
if (threadImpl != null) throw context.runtime.newThreadError("already initialized thread");
if (threadImpl != ThreadLike.DUMMY) throw context.runtime.newThreadError("already initialized thread");

return startThread(context, new RubyRunnable(this, args, block));
}
@@ -665,7 +665,7 @@ private static RubyThread startThread(final IRubyObject recv, final IRubyObject[
if (callInit) {
rubyThread.callInit(args, block);

if (rubyThread.threadImpl == null) {
if (rubyThread.threadImpl == ThreadLike.DUMMY) {
throw recv.getRuntime().newThreadError("uninitialized thread - check " + ((RubyClass) recv).getName() + "#initialize");
}
} else {
@@ -1979,15 +1979,15 @@ public boolean equals(Object obj) {
return false;
}
final RubyThread other = (RubyThread)obj;
if (this.threadImpl != other.threadImpl && (this.threadImpl == null || !this.threadImpl.equals(other.threadImpl))) {
if (this.threadImpl != other.threadImpl && (this.threadImpl == ThreadLike.DUMMY || !this.threadImpl.equals(other.threadImpl))) {
return false;
}
return true;
}

@Override
public int hashCode() {
return 97 * 3 + (this.threadImpl != null ? this.threadImpl.hashCode() : 0);
return 97 * 3 + (this.threadImpl != ThreadLike.DUMMY ? this.threadImpl.hashCode() : 0);
}

@Override
55 changes: 55 additions & 0 deletions core/src/main/java/org/jruby/internal/runtime/ThreadLike.java
Original file line number Diff line number Diff line change
@@ -55,4 +55,59 @@ public interface ThreadLike {
public String getRubyName();

public String getReportName();

ThreadLike DUMMY = new ThreadLike() {
@Override
public void start() {}

@Override
public void interrupt() {}

@Override
public boolean isAlive() {
return false;
}

@Override
public void join() throws InterruptedException, ExecutionException {}

@Override
public void join(long millis) throws InterruptedException, ExecutionException {}

@Override
public int getPriority() {
return 0;
}

@Override
public void setPriority(int priority) {}

@Override
public boolean isCurrent() {
return false;
}

@Override
public boolean isInterrupted() {
return false;
}

@Override
public Thread nativeThread() {
return null;
}

@Override
public void setRubyName(String name) {}

@Override
public String getRubyName() {
return "uninitialized thread";
}

@Override
public String getReportName() {
return "uninitialized thread";
}
};
}
7 changes: 5 additions & 2 deletions test/mri/excludes/TestSyntax.rb
Original file line number Diff line number Diff line change
@@ -1,14 +1,17 @@
exclude :test__END___cr, "needs investigation"
exclude :test_block_after_cmdarg_in_paren, "needs investigation"
exclude :test_cmdarg_in_paren, "needs investigation"
exclude :test_constant_reassignment_nested, "needs investigation"
exclude :test_constant_reassignment_toplevel, "needs investigation"
exclude :test_dedented_heredoc_with_blank_more_indented_line, "needs investigation #4308"
exclude :test_dedented_heredoc_with_indentation, "needs investigation #4308"
exclude :test_dedented_heredoc_with_interpolated_expression, "needs investigation #4308"
exclude :test_dedented_heredoc_with_interpolated_string, "needs investigation #4308"
exclude :test_dedented_heredoc_with_newline, "hangs"
exclude :test_dedented_heredoc_without_indentationsh, "needs investigation #4308"
exclude :test_defined_empty_argument, "needs investigation"
exclude :test_do_block_in_lambda, "needs investigation"
exclude :test_duplicated_when, "needs investigation"
exclude :test_integer_suffix, "needs investigation"
exclude :test_invalid_next, "needs investigation"
exclude :test_parenthesised_statement_argument, "needs investigation"
exclude :test_warn_unreachable, "needs investigation"
exclude :test_warning_literal_in_condition, "needs investigation"