From cce34dca72593db9795aff34c65cf1c4b133573e Mon Sep 17 00:00:00 2001 From: MenTaLguY Date: Thu, 24 May 2007 00:36:23 -0400 Subject: [PATCH] initial cleanup for new JRuby version --- java/concurrent/FuturesService.java | 152 ++++++++++++++++++++++-------------- 1 file changed, 92 insertions(+), 60 deletions(-) diff --git a/java/concurrent/FuturesService.java b/java/concurrent/FuturesService.java index 59246e7..259a614 100644 --- a/java/concurrent/FuturesService.java +++ b/java/concurrent/FuturesService.java @@ -32,14 +32,16 @@ import java.io.IOException; import java.util.Iterator; import java.util.Map; -import org.jruby.IRuby; +import org.jruby.Ruby; import org.jruby.RubyArray; import org.jruby.RubyClass; import org.jruby.RubyException; import org.jruby.RubyFixnum; import org.jruby.RubyFloat; +import org.jruby.RubyHash; import org.jruby.RubyInteger; import org.jruby.RubyModule; +import org.jruby.RubyProc; import org.jruby.RubyString; import org.jruby.ast.Node; import org.jruby.exceptions.RaiseException; @@ -53,18 +55,18 @@ import org.jruby.runtime.load.BasicLibraryService; import org.jruby.runtime.builtin.IRubyObject; public class FuturesService implements BasicLibraryService { - public boolean basicLoad(final IRuby runtime) throws IOException { + public boolean basicLoad(final Ruby runtime) throws IOException { Thunk.setup(runtime); return true; } public static class Thunk implements IRubyObject { - private IRuby runtime; + private Ruby runtime; private RubyClass klass; private IRubyObject source; private IRubyObject value; - Thunk(IRuby runtime, RubyClass klass, IRubyObject source) { + Thunk(Ruby runtime, RubyClass klass, IRubyObject source) { this.runtime = runtime; this.klass = klass; this.source = source; @@ -75,7 +77,7 @@ public class FuturesService implements BasicLibraryService { return new Thunk(recv.getRuntime(), (RubyClass)recv, source); } - public static void setup(final IRuby runtime) throws IOException { + public static void setup(final Ruby runtime) throws IOException { RubyClass cThunk = runtime.getOrCreateModule("Concurrent").defineModuleUnder("Futures").defineClassUnder("Thunk", null, ObjectAllocator.NOT_ALLOCATABLE_ALLOCATOR); CallbackFactory cb = runtime.callbackFactory(Thunk.class); cThunk.getMetaClass().defineMethod("new", cb.getSingletonMethod("newInstance", IRubyObject.class)); @@ -152,34 +154,54 @@ public class FuturesService implements BasicLibraryService { return evalThunk(this).getInstanceVariables(); } + public void setInstanceVariables(Map instanceVariables) { + evalThunk(this).setInstanceVariables(instanceVariables); + } + public Map getInstanceVariablesSnapshot() { return evalThunk(this).getInstanceVariablesSnapshot(); } - public IRubyObject callMethod(ThreadContext context, RubyModule rubyclass, String name, IRubyObject[] args, CallType callType, Block block) { - return evalThunk(this).callMethod(context, rubyclass, name, args, callType, block); + public IRubyObject compilerCallMethod(ThreadContext context, String name, IRubyObject[] args, IRubyObject caller, CallType callType, Block block) { + return evalThunk(this).compilerCallMethod(context, name, args, caller, callType, block); } - public IRubyObject callMethod(ThreadContext context, RubyModule rubyclass, byte switchValue, String name, IRubyObject[] args, CallType callType) { - return evalThunk(this).callMethod(context, rubyclass, switchValue, name, args, callType); + public IRubyObject compilerCallMethodWithIndex(ThreadContext context, int methodIndex, String name, IRubyObject[] args, IRubyObject caller, CallType callType, Block block) { + return evalThunk(this).compilerCallMethodWithIndex(context, methodIndex, name, args, caller, callType, block); + } + + public IRubyObject callMethod(ThreadContext context, RubyModule rubyclass, String name, IRubyObject[] args, CallType callType, Block block) { + return evalThunk(this).callMethod(context, rubyclass, name, args, callType, block); } - public IRubyObject callMethod(ThreadContext context, byte switchValue, String name, IRubyObject[] args, CallType callType, Block block) { - return evalThunk(this).callMethod(context, switchValue, name, args, callType, block); + public IRubyObject callMethod(ThreadContext context, RubyModule rubyclass, int index, String name, IRubyObject[] args, CallType callType, Block block) { + return evalThunk(this).callMethod(context, rubyclass, index, name, args, callType, block); } public IRubyObject callMethod(ThreadContext context, String name, IRubyObject[] args, CallType callType) { return evalThunk(this).callMethod(context, name, args, callType); } + public IRubyObject callMethod(ThreadContext context, int index, String name, IRubyObject[] args, CallType callType) { + return evalThunk(this).callMethod(context, index, name, args, callType); + } + public IRubyObject callMethod(ThreadContext context, String name, IRubyObject[] args, CallType callType, Block block) { return evalThunk(this).callMethod(context, name, args, callType, block); } + public IRubyObject callMethod(ThreadContext context, int index, String name, IRubyObject[] args) { + return evalThunk(this).callMethod(context, index, name, args); + } + public IRubyObject callMethod(ThreadContext context, String name) { return evalThunk(this).callMethod(context, name); } + public IRubyObject callMethod(ThreadContext context, int index, String name) { + return evalThunk(this).callMethod(context, index, name); + } + public IRubyObject callMethod(ThreadContext context, String name, Block block) { return evalThunk(this).callMethod(context, name, block); } @@ -188,6 +210,9 @@ public class FuturesService implements BasicLibraryService { return evalThunk(this).callMethod(context, name, arg); } + public IRubyObject callMethod(ThreadContext context, int index, String name, IRubyObject arg) { + return evalThunk(this).callMethod(context, index, name, arg); + } public IRubyObject callMethod(ThreadContext context, String name, IRubyObject[] args) { return evalThunk(this).callMethod(context, name, args); } @@ -196,6 +221,10 @@ public class FuturesService implements BasicLibraryService { return evalThunk(this).callMethod(context, name, args, block); } + public IRubyObject callSuper(ThreadContext context, IRubyObject[] args, Block block) { + return evalThunk(this).callSuper(context, args, block); + } + public boolean isNil() { return evalThunk(this).isNil(); } @@ -216,6 +245,10 @@ public class FuturesService implements BasicLibraryService { return evalThunk(this).isImmediate(); } + public IRubyObject infectBy(IRubyObject obj) { + return evalThunk(this).infectBy(obj); + } + public RubyClass getMetaClass() { return evalThunk(this).getMetaClass(); } @@ -240,7 +273,7 @@ public class FuturesService implements BasicLibraryService { return evalThunk(this).respondsTo(method); } - public IRuby getRuntime() { + public Ruby getRuntime() { return this.runtime; } @@ -248,29 +281,28 @@ public class FuturesService implements BasicLibraryService { return evalThunk(this).getJavaClass(); } - public IRubyObject eval(Node iNode) { - return evalThunk(this).eval(iNode); - } - - public IRubyObject evalWithBinding(ThreadContext context, IRubyObject evalString, IRubyObject binding, String file) { - return evalThunk(this).evalWithBinding(context, evalString, binding, file); + public IRubyObject evalWithBinding(ThreadContext context, IRubyObject evalString, IRubyObject binding, String file, int lineNumber) { + return evalThunk(this).evalWithBinding(context, evalString, binding, file, lineNumber); } public IRubyObject evalSimple(ThreadContext context, IRubyObject evalString, String file) { return evalThunk(this).evalSimple(context, evalString, file); } - public void extendObject(RubyModule rubyModule) { - evalThunk(this).extendObject(rubyModule); - } - public String asSymbol() { return evalThunk(this).asSymbol(); } + public RubyString asString() { + return evalThunk(this).asString(); + } + public RubyArray convertToArray() { return evalThunk(this).convertToArray(); } + public RubyHash convertToHash() { + return evalThunk(this).convertToHash(); + } public RubyFloat convertToFloat() { return evalThunk(this).convertToFloat(); } @@ -281,34 +313,26 @@ public class FuturesService implements BasicLibraryService { return evalThunk(this).convertToString(); } - public IRubyObject convertToType(String targetType, String convertMethod, boolean raiseOnError) { - return evalThunk(this).convertToType(targetType, convertMethod, raiseOnError); + public IRubyObject convertToType(RubyClass targetType, int convertMethodIndex, String convertMethod, boolean raiseOnError) { + return evalThunk(this).convertToType(targetType, convertMethodIndex, convertMethod, raiseOnError); } - public IRubyObject convertToTypeWithCheck(String targetType, String convertMethod) { - return evalThunk(this).convertToTypeWithCheck(targetType, convertMethod); - } - - public void setTaint(boolean b) { - evalThunk(this).setTaint(b); + public IRubyObject convertToTypeWithCheck(RubyClass targetType, int convertMethodIndex, String convertMethod) { + return evalThunk(this).convertToTypeWithCheck(targetType, convertMethodIndex, convertMethod); } - public void checkSafeString() { - evalThunk(this).checkSafeString(); + public IRubyObject convertToType(RubyClass targetType, int convertMethodIndex, String convertMethod, boolean raiseOnMissingMethod, boolean raiseOnWrongTypeResult, boolean allowNilThrough) { + return evalThunk(this).convertToType(targetType, convertMethodIndex, convertMethod, raiseOnMissingMethod, raiseOnWrongTypeResult, allowNilThrough); } - public IRubyObject convertType(Class type, String string, String string1) { - return evalThunk(this).convertType(type, string, string1); + public void setTaint(boolean b) { + evalThunk(this).setTaint(b); } public IRubyObject dup() { return evalThunk(this).dup(); } - public void initCopy(IRubyObject original) { - evalThunk(this).initCopy(original); - } - public void setFrozen(boolean b) { evalThunk(this).setFrozen(b); } @@ -317,24 +341,8 @@ public class FuturesService implements BasicLibraryService { return evalThunk(this).inspect(); } - public int checkArgumentCount(IRubyObject[] arguments, int minimum, int maximum) { - return evalThunk(this).checkArgumentCount(arguments, minimum, maximum); - } - - public IRubyObject rbClone() { - return evalThunk(this).rbClone(); - } - - public void callInit(IRubyObject[] args, Block block) { - evalThunk(this).callInit(args, block); - } - - public void defineSingletonMethod(String name, Callback callback) { - evalThunk(this).defineSingletonMethod(name, callback); - } - - public boolean singletonMethodsAllowed() { - return evalThunk(this).singletonMethodsAllowed(); + public IRubyObject rbClone(Block unusedBlock) { + return evalThunk(this).rbClone(unusedBlock); } public boolean isSingleton() { @@ -345,10 +353,6 @@ public class FuturesService implements BasicLibraryService { return evalThunk(this).instanceVariableNames(); } - public IRubyObject[] scanArgs(IRubyObject[] args, int required, int optional) { - return evalThunk(this).scanArgs(args, required, optional); - } - public void dataWrapStruct(Object obj) { evalThunk(this).dataWrapStruct(obj); } @@ -368,6 +372,34 @@ public class FuturesService implements BasicLibraryService { public IRubyObject checkStringType() { return evalThunk(this).checkStringType(); } + + public IRubyObject checkArrayType() { + return evalThunk(this).checkArrayType(); + } + + public IRubyObject equal(IRubyObject other) { + return evalThunk(this).equal(other); + } + + public IRubyObject equalInternal(final ThreadContext context, final IRubyObject other) { + return evalThunk(this).equalInternal(context, other); + } + + public boolean eql(IRubyObject other) { + return evalThunk(this).eql(other); + } + + public boolean eqlInternal(final ThreadContext context, final IRubyObject other) { + return evalThunk(this).eqlInternal(context, other); + } + + public void addFinalizer(RubyProc finalizer) { + evalThunk(this).addFinalizer(finalizer); + } + + public void removeFinalizers() { + evalThunk(this).removeFinalizers(); + } } } -- 2.11.4.GIT