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

Commits on Jan 2, 2018

  1. Copy the full SHA
    e16a673 View commit details
  2. Copy the full SHA
    3afa8b1 View commit details
Showing with 27 additions and 10 deletions.
  1. +12 −8 core/src/main/java/org/jruby/RubyBasicObject.java
  2. +14 −2 core/src/main/java/org/jruby/RubyKernel.java
  3. +1 −0 core/src/main/java/org/jruby/RubyObject.java
20 changes: 12 additions & 8 deletions core/src/main/java/org/jruby/RubyBasicObject.java
Original file line number Diff line number Diff line change
@@ -2107,31 +2107,34 @@ public void checkFrozen() {
* in both the compiler and the interpreter, the performance
* benefit is important for this method.
*/
@Deprecated // NOTE: does not match Ruby 2.x rules (does method bound check only)
public final RubyBoolean respond_to_p(IRubyObject mname) {
return getRuntime().newBoolean(getMetaClass().respondsToMethod(mname.asJavaString(), true));
}

@Deprecated
public final RubyBoolean respond_to_p19(IRubyObject mname) {
return respond_to_p19(mname, false);
return respond_to_p(getRuntime().getCurrentContext(), mname, false);
}

@Deprecated // NOTE: does not match Ruby 2.x rules (does method bound check only)
public final RubyBoolean respond_to_p(IRubyObject mname, IRubyObject includePrivate) {
String name = mname.asJavaString();
return getRuntime().newBoolean(getMetaClass().isMethodBound(name, !includePrivate.isTrue()));
}

@Deprecated
public final RubyBoolean respond_to_p19(IRubyObject mname, IRubyObject includePrivate) {
return respond_to_p19(mname, includePrivate.isTrue());
return respond_to_p(getRuntime().getCurrentContext(), mname, includePrivate.isTrue());
}

private RubyBoolean respond_to_p19(IRubyObject mname, final boolean includePrivate) {
final Ruby runtime = getRuntime();
final String name = mname.asJavaString();
final RubyBoolean respond_to_p(ThreadContext context, IRubyObject methodName, final boolean includePrivate) {
final Ruby runtime = context.runtime;
final String name = methodName.asJavaString();
if (getMetaClass().respondsToMethod(name, !includePrivate)) return runtime.getTrue();
// MRI (1.9) always passes down a symbol when calling respond_to_missing?
if ( ! (mname instanceof RubySymbol) ) mname = runtime.newSymbol(name);
ThreadContext context = runtime.getCurrentContext();
IRubyObject respond = sites(context).respond_to_missing.call(context, this, this, mname, runtime.newBoolean(includePrivate));
if ( ! (methodName instanceof RubySymbol) ) methodName = runtime.newSymbol(name);
IRubyObject respond = sites(context).respond_to_missing.call(context, this, this, methodName, runtime.newBoolean(includePrivate));
return runtime.newBoolean( respond.isTrue() );
}

@@ -2160,6 +2163,7 @@ public RubyClass type() {
* The deprecated version of type, that emits a deprecation
* warning.
*/
@Deprecated
public RubyClass type_deprecated() {
getRuntime().getWarnings().warn(ID.DEPRECATED_METHOD, "Object#type is deprecated; use Object#class");
return type();
16 changes: 14 additions & 2 deletions core/src/main/java/org/jruby/RubyKernel.java
Original file line number Diff line number Diff line change
@@ -1892,24 +1892,36 @@ public static IRubyObject initialize_dup(ThreadContext context, IRubyObject self
return sites(context).initialize_copy.call(context, self, self, original);
}

@Deprecated
public static RubyBoolean respond_to_p(IRubyObject self, IRubyObject mname) {
return ((RubyBasicObject) self).respond_to_p(mname);
}

@JRubyMethod(name = "respond_to?")
@Deprecated
public static IRubyObject respond_to_p19(IRubyObject self, IRubyObject mname) {
return ((RubyBasicObject) self).respond_to_p19(mname);
}

@Deprecated
public static RubyBoolean respond_to_p(IRubyObject self, IRubyObject mname, IRubyObject includePrivate) {
return ((RubyBasicObject) self).respond_to_p(mname, includePrivate);
}

@JRubyMethod(name = "respond_to?")
@Deprecated
public static IRubyObject respond_to_p19(IRubyObject self, IRubyObject mname, IRubyObject includePrivate) {
return ((RubyBasicObject) self).respond_to_p19(mname, includePrivate);
}

@JRubyMethod(name = "respond_to?")
public static IRubyObject respond_to_p(ThreadContext context, IRubyObject self, IRubyObject name) {
return ((RubyBasicObject) self).respond_to_p(context, name, false);
}

@JRubyMethod(name = "respond_to?")
public static IRubyObject respond_to_p(ThreadContext context, IRubyObject self, IRubyObject name, IRubyObject includePrivate) {
return ((RubyBasicObject) self).respond_to_p(context, name, includePrivate.isTrue());
}

@JRubyMethod
public static RubyFixnum hash(IRubyObject self) {
return ((RubyBasicObject)self).hash();
1 change: 1 addition & 0 deletions core/src/main/java/org/jruby/RubyObject.java
Original file line number Diff line number Diff line change
@@ -312,6 +312,7 @@ public ClassIndex getNativeClassIndex() {

/**
* Simple helper to print any objects.
* @deprecated no longer used - uses Java's System.out
*/
public static void puts(Object obj) {
System.out.println(obj.toString());