Skip to content

Commit

Permalink
Showing 2 changed files with 33 additions and 34 deletions.
19 changes: 10 additions & 9 deletions core/src/main/java/org/jruby/RubyMethod.java
Original file line number Diff line number Diff line change
@@ -37,6 +37,7 @@
import org.jruby.internal.runtime.methods.DynamicMethod;
import org.jruby.internal.runtime.methods.IRMethodArgs;
import org.jruby.internal.runtime.methods.ProcMethod;
import org.jruby.internal.runtime.methods.WrapperMethod;
import org.jruby.runtime.ArgumentDescriptor;
import org.jruby.runtime.Block;
import org.jruby.runtime.ClassIndex;
@@ -249,10 +250,10 @@ public IRubyObject inspect() {
str.catString(getType().getName()).catString(": ");

RubyModule definedClass;
RubyModule mklass = method.getImplementationClass();
RubyModule mklass = originModule;

if (method instanceof AliasMethod) {
definedClass = method.getRealMethod().getImplementationClass();
if (method instanceof AliasMethod || method instanceof WrapperMethod) {
definedClass = method.getRealMethod().getDefinedClass();
}
else {
definedClass = method.getDefinedClass();
@@ -262,10 +263,10 @@ public IRubyObject inspect() {
definedClass = definedClass.getMetaClass();
}

if (implementationModule.isSingleton()) {
IRubyObject attached = ((MetaClass) implementationModule).getAttached();
if (mklass.isSingleton()) {
IRubyObject attached = ((MetaClass) mklass).getAttached();
if (receiver == null) {
str.cat19(inspect(context, implementationModule).convertToString());
str.cat19(inspect(context, mklass).convertToString());
} else if (receiver == attached) {
str.cat19(inspect(context, attached).convertToString());
sharp = ".";
@@ -277,10 +278,10 @@ public IRubyObject inspect() {
sharp = ".";
}
} else {
str.catString(originModule.getName());
if (implementationModule != originModule) {
str.catString(mklass.getName());
if (definedClass != mklass) {
str.catString("(");
str.catString(implementationModule.getName());
str.catString(definedClass.getName());
str.catString(")");
}
}
Original file line number Diff line number Diff line change
@@ -42,67 +42,65 @@
*/
public class AliasMethod extends DynamicMethod {
private DynamicMethod oldMethod;
private String oldName;

public AliasMethod(RubyModule implementationClass, DynamicMethod oldMethod, String oldName) {
super(implementationClass, oldMethod.getVisibility());
super(implementationClass, oldMethod.getVisibility(), oldName);

this.oldName = oldName;
this.oldMethod = oldMethod;
}

@Override
public IRubyObject call(ThreadContext context, IRubyObject self, RubyModule klazz, String name) {
return oldMethod.call(context, self, klazz, oldName);
public IRubyObject call(ThreadContext context, IRubyObject self, RubyModule klazz, String unused) {
return oldMethod.call(context, self, klazz, name);
}

@Override
public IRubyObject call(ThreadContext context, IRubyObject self, RubyModule klazz, String name, IRubyObject arg) {
return oldMethod.call(context, self, klazz, oldName, arg);
public IRubyObject call(ThreadContext context, IRubyObject self, RubyModule klazz, String unused, IRubyObject arg) {
return oldMethod.call(context, self, klazz, name, arg);
}

@Override
public IRubyObject call(ThreadContext context, IRubyObject self, RubyModule klazz, String name, IRubyObject arg1, IRubyObject arg2) {
return oldMethod.call(context, self, klazz, oldName, arg1, arg2);
public IRubyObject call(ThreadContext context, IRubyObject self, RubyModule klazz, String unused, IRubyObject arg1, IRubyObject arg2) {
return oldMethod.call(context, self, klazz, name, arg1, arg2);
}

@Override
public IRubyObject call(ThreadContext context, IRubyObject self, RubyModule klazz, String name, IRubyObject arg1, IRubyObject arg2, IRubyObject arg3) {
return oldMethod.call(context, self, klazz, oldName, arg1, arg2, arg3);
public IRubyObject call(ThreadContext context, IRubyObject self, RubyModule klazz, String unused, IRubyObject arg1, IRubyObject arg2, IRubyObject arg3) {
return oldMethod.call(context, self, klazz, name, arg1, arg2, arg3);
}

@Override
public IRubyObject call(ThreadContext context, IRubyObject self, RubyModule klazz, String name, IRubyObject[] args) {
return oldMethod.call(context, self, klazz, oldName, args);
public IRubyObject call(ThreadContext context, IRubyObject self, RubyModule klazz, String unused, IRubyObject[] args) {
return oldMethod.call(context, self, klazz, name, args);
}

@Override
public IRubyObject call(ThreadContext context, IRubyObject self, RubyModule klazz, String name, Block block) {
return oldMethod.call(context, self, klazz, oldName, block);
public IRubyObject call(ThreadContext context, IRubyObject self, RubyModule klazz, String unused, Block block) {
return oldMethod.call(context, self, klazz, name, block);
}

@Override
public IRubyObject call(ThreadContext context, IRubyObject self, RubyModule klazz, String name, IRubyObject arg1, Block block) {
return oldMethod.call(context, self, klazz, oldName, arg1, block);
public IRubyObject call(ThreadContext context, IRubyObject self, RubyModule klazz, String unused, IRubyObject arg1, Block block) {
return oldMethod.call(context, self, klazz, name, arg1, block);
}

@Override
public IRubyObject call(ThreadContext context, IRubyObject self, RubyModule klazz, String name, IRubyObject arg1, IRubyObject arg2, Block block) {
return oldMethod.call(context, self, klazz, oldName, arg1, arg2, block);
public IRubyObject call(ThreadContext context, IRubyObject self, RubyModule klazz, String unused, IRubyObject arg1, IRubyObject arg2, Block block) {
return oldMethod.call(context, self, klazz, name, arg1, arg2, block);
}

@Override
public IRubyObject call(ThreadContext context, IRubyObject self, RubyModule klazz, String name, IRubyObject arg1, IRubyObject arg2, IRubyObject arg3, Block block) {
return oldMethod.call(context, self, klazz, oldName, arg1, arg2, arg3, block);
public IRubyObject call(ThreadContext context, IRubyObject self, RubyModule klazz, String unused, IRubyObject arg1, IRubyObject arg2, IRubyObject arg3, Block block) {
return oldMethod.call(context, self, klazz, name, arg1, arg2, arg3, block);
}

@Override
public IRubyObject call(ThreadContext context, IRubyObject self, RubyModule klazz, String name, IRubyObject[] args, Block block) {
return oldMethod.call(context, self, klazz, oldName, args, block);
public IRubyObject call(ThreadContext context, IRubyObject self, RubyModule klazz, String unused, IRubyObject[] args, Block block) {
return oldMethod.call(context, self, klazz, name, args, block);
}

public DynamicMethod dup() {
return new AliasMethod(implementationClass, oldMethod, oldName);
return new AliasMethod(implementationClass, oldMethod, name);
}

@Override
@@ -111,7 +109,7 @@ public Arity getArity(){
}

public String getOldName() {
return oldName;
return name;
}

@Override

0 comments on commit 4cdf882

Please sign in to comment.