Skip to content

Commit

Permalink
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Eliminate "base" java class proxy initialization.
Browse files Browse the repository at this point in the history
All it did was define the long-defunct __jsend! method, which is
superceded for many years by java_send.
headius committed Apr 22, 2015
1 parent 68ac7f9 commit 759b924
Showing 4 changed files with 0 additions and 27 deletions.
Original file line number Diff line number Diff line change
@@ -28,8 +28,6 @@ public RubyModule initialize(RubyModule proxy) {

final State state = new State(runtime, superclass);

super.initializeBase(proxy);

proxyClass.setReifiedClass(javaClass);

runtime.getJavaSupport().getUnfinishedProxyClassCache().get(javaClass).set(proxyClass);
22 changes: 0 additions & 22 deletions core/src/main/java/org/jruby/javasupport/binding/Initializer.java
Original file line number Diff line number Diff line change
@@ -381,28 +381,6 @@ private static void setJavaClassFor(final Class<?> javaClass, final RubyModule p

public abstract RubyModule initialize(RubyModule proxy);

public void initializeBase(RubyModule proxy) {
proxy.addMethod("__jsend!", new org.jruby.internal.runtime.methods.JavaMethod.JavaMethodNBlock(proxy, PUBLIC) {
@Override
public IRubyObject call(ThreadContext context, IRubyObject self, RubyModule clazz, String name, IRubyObject[] args, Block block) {
String callName = args[0].asJavaString();

DynamicMethod method = self.getMetaClass().searchMethod(callName);
int v = method.getArity().getValue();

IRubyObject[] newArgs = new IRubyObject[args.length - 1];
System.arraycopy(args, 1, newArgs, 0, newArgs.length);

if(v < 0 || v == (newArgs.length)) {
return Helpers.invoke(context, self, callName, newArgs, Block.NULL_BLOCK);
} else {
RubyClass superClass = self.getMetaClass().getSuperClass();
return Helpers.invokeAs(context, superClass, self, callName, newArgs, Block.NULL_BLOCK);
}
}
});
}

public static class State {

final Map<String, AssignedName> staticNames;
Original file line number Diff line number Diff line change
@@ -23,8 +23,6 @@ public InterfaceInitializer(Ruby runtime, Class<?> javaClass) {
public RubyModule initialize(RubyModule proxy) {
final State state = new State(runtime, null);

super.initializeBase(proxy);

runtime.getJavaSupport().getUnfinishedProxyClassCache().get(javaClass).set(proxy);

Field[] fields = JavaClass.getDeclaredFields(javaClass);
Original file line number Diff line number Diff line change
@@ -568,7 +568,6 @@ public static RubyObject get(IRubyObject self, IRubyObject obj) {
EXCLUDE_METHODS.add("java_class");
EXCLUDE_METHODS.add("java_object");
EXCLUDE_METHODS.add("__jcreate!");
EXCLUDE_METHODS.add("__jsend!");
}

@JRubyMethod(meta = true)

0 comments on commit 759b924

Please sign in to comment.