Skip to content

Commit

Permalink
Add java_method, java_alias, and java_send to interface modules.
Browse files Browse the repository at this point in the history
Part of improvements to support #2857. Specs pending.
  • Loading branch information
headius committed Apr 22, 2015
1 parent ab3b1d5 commit 563c402
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 2 deletions.
Expand Up @@ -21,6 +21,10 @@ public StaticMethodInvoker(RubyClass host, Method method) {
super(host, method);
}

public StaticMethodInvoker(RubyModule host, Method method) {
super(host, method);
}

@Override
public IRubyObject call(ThreadContext context, IRubyObject self, RubyModule clazz, String name, IRubyObject[] args) {
JavaMethod method = (JavaMethod) findCallable(self, name, args, args.length);
Expand Down
Expand Up @@ -37,6 +37,8 @@ public static RubyModule createJavaInterfaceTemplateModule(ThreadContext context
singleton.addReadAttribute(context, "java_class");
singleton.defineAnnotatedMethods(JavaInterfaceTemplate.class);

JavaInterfaceTemplate.defineAnnotatedMethods(Java.JavaProxyClassMethods.class);

return JavaInterfaceTemplate;
}

Expand Down
4 changes: 2 additions & 2 deletions core/src/main/java/org/jruby/javasupport/Java.java
Expand Up @@ -676,10 +676,10 @@ public static IRubyObject java_alias(ThreadContext context, IRubyObject clazz, I

private static IRubyObject getRubyMethod(ThreadContext context, IRubyObject clazz, String name, Class... argTypesClasses) {
final Ruby runtime = context.runtime;
if ( ! ( clazz instanceof RubyClass ) ) {
if ( ! ( clazz instanceof RubyModule ) ) {
throw runtime.newTypeError(clazz, runtime.getModule());
}
final RubyClass proxyClass = (RubyClass) clazz;
final RubyModule proxyClass = (RubyModule) clazz;

final Method method = getMethodFromClass(context, clazz, name, argTypesClasses);
final String prettyName = name + CodegenUtils.prettyParams(argTypesClasses);
Expand Down

0 comments on commit 563c402

Please sign in to comment.