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

Commits on Jul 11, 2018

  1. Verified

    This commit was signed with the committer’s verified signature.
    sachinraja Sachin Raja
    Copy the full SHA
    466b27a View commit details

Commits on Jul 12, 2018

  1. Verified

    This commit was signed with the committer’s verified signature.
    sachinraja Sachin Raja
    Copy the full SHA
    f6447e9 View commit details
  2. Verified

    This commit was signed with the committer’s verified signature.
    sachinraja Sachin Raja
    Copy the full SHA
    5371240 View commit details
  3. Verified

    This commit was signed with the committer’s verified signature.
    sachinraja Sachin Raja
    Copy the full SHA
    116e3ab View commit details
11 changes: 9 additions & 2 deletions core/src/main/java/org/jruby/RubyModule.java
Original file line number Diff line number Diff line change
@@ -2255,7 +2255,9 @@ public IRubyObject initialize_copy(IRubyObject original) {

RubyModule originalModule = (RubyModule)original;

if (!getMetaClass().isSingleton()) setMetaClass(originalModule.getSingletonClassClone());
if (!getMetaClass().isSingleton()) {
setMetaClass(originalModule.getSingletonClassCloneAndAttach(this));
}
setSuperClass(originalModule.getSuperClass());
if (originalModule.hasVariables()) syncVariables(originalModule);
syncConstants(originalModule);
@@ -2376,7 +2378,12 @@ public RubyString to_s() {
if (attached instanceof RubyClass || attached instanceof RubyModule) {
buffer.cat19(attached.inspect().convertToString());
} else {
buffer.cat19((RubyString) attached.anyToString());
try {
buffer.cat19((RubyString) attached.anyToString());
} catch (NullPointerException npe) {
npe.printStackTrace();
throw npe;
}
}
}
buffer.cat19(runtime.newString(">"));
Original file line number Diff line number Diff line change
@@ -112,6 +112,10 @@ public DynamicMethod getRealMethod() {
return method.getRealMethod();
}

public DynamicMethod getDelegate() {
return method;
}

@Override
public Arity getArity() {
return method.getArity();
5 changes: 4 additions & 1 deletion core/src/main/java/org/jruby/ir/targets/InvokeSite.java
Original file line number Diff line number Diff line change
@@ -15,6 +15,7 @@
import org.jruby.RubySymbol;
import org.jruby.internal.runtime.methods.AliasMethod;
import org.jruby.internal.runtime.methods.DynamicMethod;
import org.jruby.internal.runtime.methods.PartialDelegatingMethod;
import org.jruby.ir.JIT;
import org.jruby.runtime.Block;
import org.jruby.runtime.CallType;
@@ -411,7 +412,9 @@ public static IRubyObject negate(IRubyObject object, RubyNil nil, RubyBoolean.Tr
MethodHandle buildAliasHandle(DynamicMethod method, IRubyObject self, RubyClass dispatchClass) throws Throwable {
MethodHandle mh = null;

if (method instanceof AliasMethod) {
if (method instanceof PartialDelegatingMethod) {
mh = getHandle(self, dispatchClass, ((PartialDelegatingMethod) method).getDelegate());
} else if (method instanceof AliasMethod) {
AliasMethod alias = (AliasMethod) method;
DynamicMethod innerMethod = alias.getRealMethod();
String name = alias.getName();
8 changes: 8 additions & 0 deletions spec/ruby/core/module/initialize_copy_spec.rb
Original file line number Diff line number Diff line change
@@ -7,4 +7,12 @@ def mod.hello
end
mod.dup.methods(false).should == [:hello]
end

# jruby/jruby#5245, https://bugs.ruby-lang.org/issues/3461
it "should produce a duped module with inspectable class methods" do
mod = Module.new
def mod.hello
end
mod.dup.method(:hello).inspect.should =~ /Module.*hello/
end
end
1 change: 0 additions & 1 deletion test/mri/excludes/TestModule.rb
Original file line number Diff line number Diff line change
@@ -5,7 +5,6 @@
exclude :test_define_module_under_private_constant, "we don't evaluate colon2-like class opening via colon2 logic, can't tell if private are ok"
exclude :test_include_module_with_constants_does_not_invalidate_method_cache, "no RubyVM constant in JRuby"
exclude :test_initialize_copy_empty, "needs investigation"
exclude :test_inspect_segfault, "a minor inspect difference?"
exclude :test_invalid_attr, "needs investigation"
exclude :test_method_redefinition, "needs investigation"
exclude :test_private_constant_reopen, "needs investigation"