public static IRubyObject get_java_class(IRubyObject recv, IRubyObject name) { try { return JavaClass.for_name(recv, name); } catch (Exception e) { recv.getRuntime().getJavaSupport().handleNativeException(e, null); return recv.getRuntime().getNil(); } }
public static IRubyObject get_java_class(final IRubyObject self, final IRubyObject name) { try { return JavaClass.for_name(self, name); } catch (Exception e) { self.getRuntime().getJavaSupport().handleNativeException(e, null); return self.getRuntime().getNil(); } }
public IRubyObject new_instance(Object[] arguments) { checkArity(arguments.length); try { Object result = constructor.newInstance(arguments); return JavaObject.wrap(getRuntime(), result); } catch (IllegalArgumentException iae) { throw getRuntime().newTypeError("expected " + argument_types().inspect() + ", got [" + arguments[0].getClass().getName() + ", ...]"); } catch (IllegalAccessException iae) { throw getRuntime().newTypeError("illegal access"); } catch (InvocationTargetException ite) { getRuntime().getJavaSupport().handleNativeException(ite.getTargetException(), constructor); // not reached assert false; return null; } catch (InstantiationException ie) { throw getRuntime().newTypeError("can't make instance of " + constructor.getDeclaringClass().getName()); } }
public static IRubyObject get_java_class(final IRubyObject self, final IRubyObject name) { try { return JavaClass.for_name(self, name); } catch (Exception e) { self.getRuntime().getJavaSupport().handleNativeException(e, null); return self.getRuntime().getNil(); } }
public static IRubyObject get_java_class(IRubyObject recv, IRubyObject name) { try { return JavaClass.for_name(recv, name); } catch (Exception e) { recv.getRuntime().getJavaSupport().handleNativeException(e, null); return recv.getRuntime().getNil(); } }
/** * High-level object conversion utility function 'java_to_primitive' is the low-level version */ @Deprecated @JRubyMethod(module = true, visibility = PRIVATE) public static IRubyObject java_to_ruby(IRubyObject recv, IRubyObject object, Block unusedBlock) { try { return JavaUtil.java_to_ruby(recv.getRuntime(), object); } catch (RuntimeException e) { recv.getRuntime().getJavaSupport().handleNativeException(e, null); // This point is only reached if there was an exception handler installed. return recv.getRuntime().getNil(); } }
/** * High-level object conversion utility function 'java_to_primitive' is the low-level version */ @Deprecated @JRubyMethod(frame = true, module = true, visibility = PRIVATE) public static IRubyObject java_to_ruby(IRubyObject recv, IRubyObject object, Block unusedBlock) { try { return JavaUtil.java_to_ruby(recv.getRuntime(), object); } catch (RuntimeException e) { recv.getRuntime().getJavaSupport().handleNativeException(e, null); // This point is only reached if there was an exception handler installed. return recv.getRuntime().getNil(); } }
public IRubyObject new_instance(Object[] arguments) { checkArity(arguments.length); try { Object result = constructor.newInstance(arguments); return JavaObject.wrap(getRuntime(), result); } catch (IllegalArgumentException iae) { throw getRuntime().newTypeError("expected " + argument_types().inspect() + ", got [" + arguments[0].getClass().getName() + ", ...]"); } catch (IllegalAccessException iae) { throw getRuntime().newTypeError("illegal access"); } catch (InvocationTargetException ite) { getRuntime().getJavaSupport().handleNativeException(ite.getTargetException(), constructor); // not reached assert false; return null; } catch (InstantiationException ie) { throw getRuntime().newTypeError("can't make instance of " + constructor.getDeclaringClass().getName()); } }
/** * High-level object conversion utility function 'java_to_primitive' is the low-level version */ @Deprecated @JRubyMethod(frame = true, module = true, visibility = PRIVATE) public static IRubyObject java_to_ruby(IRubyObject recv, IRubyObject object, Block unusedBlock) { try { return JavaUtil.java_to_ruby(recv.getRuntime(), object); } catch (RuntimeException e) { recv.getRuntime().getJavaSupport().handleNativeException(e, null); // This point is only reached if there was an exception handler installed. return recv.getRuntime().getNil(); } }
public final IRubyObject new_instance(final Object[] arguments) { checkArity(arguments.length); try { Object result = constructor.newInstance(arguments); return JavaObject.wrap(getRuntime(), result); } catch (IllegalArgumentException iae) { return handlelIllegalArgumentEx(iae, constructor, false, arguments); } catch (IllegalAccessException iae) { throw getRuntime().newTypeError("illegal access"); } catch (InvocationTargetException ite) { getRuntime().getJavaSupport().handleNativeException(ite.getTargetException(), constructor); // not reached assert false; return null; } catch (InstantiationException ie) { throw getRuntime().newTypeError("can't make instance of " + constructor.getDeclaringClass().getName()); } }
/** * High-level object conversion utility function 'java_to_primitive' is the low-level version */ @Deprecated @JRubyMethod(module = true, visibility = PRIVATE) public static IRubyObject java_to_ruby(IRubyObject recv, IRubyObject object, Block unusedBlock) { try { return JavaUtil.java_to_ruby(recv.getRuntime(), object); } catch (RuntimeException e) { recv.getRuntime().getJavaSupport().handleNativeException(e, null); // This point is only reached if there was an exception handler installed. return recv.getRuntime().getNil(); } }
public final IRubyObject new_instance(final Object[] arguments) { checkArity(arguments.length); try { Object result = constructor.newInstance(arguments); return JavaObject.wrap(getRuntime(), result); } catch (IllegalArgumentException iae) { return handlelIllegalArgumentEx(iae, constructor, false, arguments); } catch (IllegalAccessException iae) { throw getRuntime().newTypeError("illegal access"); } catch (InvocationTargetException ite) { getRuntime().getJavaSupport().handleNativeException(ite.getTargetException(), constructor); // not reached assert false; return null; } catch (InstantiationException ie) { throw getRuntime().newTypeError("can't make instance of " + constructor.getDeclaringClass().getName()); } }
@JRubyMethod(rest = true) public IRubyObject new_instance(IRubyObject[] args) { int length = args.length; Class<?>[] types = parameterTypes; if (length != types.length) { throw getRuntime().newArgumentError(length, types.length); } Object[] constructorArguments = new Object[length]; for (int i = length; --i >= 0; ) { constructorArguments[i] = args[i].toJava(types[i]); } try { Object result = constructor.newInstance(constructorArguments); return JavaObject.wrap(getRuntime(), result); } catch (IllegalArgumentException iae) { throw getRuntime().newTypeError("expected " + argument_types().inspect() + ", got [" + constructorArguments[0].getClass().getName() + ", ...]"); } catch (IllegalAccessException iae) { throw getRuntime().newTypeError("illegal access"); } catch (InvocationTargetException ite) { getRuntime().getJavaSupport().handleNativeException(ite.getTargetException(), constructor); // not reached assert false; return null; } catch (InstantiationException ie) { throw getRuntime().newTypeError("can't make instance of " + constructor.getDeclaringClass().getName()); } }
@JRubyMethod(rest = true) public IRubyObject new_instance(IRubyObject[] args) { int length = args.length; Class<?>[] types = parameterTypes; if (length != types.length) { throw getRuntime().newArgumentError(length, types.length); } Object[] constructorArguments = new Object[length]; for (int i = length; --i >= 0; ) { constructorArguments[i] = args[i].toJava(types[i]); } try { Object result = constructor.newInstance(constructorArguments); return JavaObject.wrap(getRuntime(), result); } catch (IllegalArgumentException iae) { throw getRuntime().newTypeError("expected " + argument_types().inspect() + ", got [" + constructorArguments[0].getClass().getName() + ", ...]"); } catch (IllegalAccessException iae) { throw getRuntime().newTypeError("illegal access"); } catch (InvocationTargetException ite) { getRuntime().getJavaSupport().handleNativeException(ite.getTargetException(), constructor); // not reached assert false; return null; } catch (InstantiationException ie) { throw getRuntime().newTypeError("can't make instance of " + constructor.getDeclaringClass().getName()); } }
if ( runtime.getDebug().isTrue() ) ex.getTargetException().printStackTrace(); runtime.getJavaSupport().handleNativeException(ex.getTargetException(), superMethod); return runtime.getNil(); // only reached if there was an exception handler installed
if ( runtime.getDebug().isTrue() ) ex.getTargetException().printStackTrace(); runtime.getJavaSupport().handleNativeException(ex.getTargetException(), superMethod); return runtime.getNil(); // only reached if there was an exception handler installed
} catch (InvocationTargetException ite) { if (getRuntime().getDebug().isTrue()) ite.getTargetException().printStackTrace(); getRuntime().getJavaSupport().handleNativeException(ite.getTargetException(), sm);
} catch (InvocationTargetException ite) { if (getRuntime().getDebug().isTrue()) ite.getTargetException().printStackTrace(); getRuntime().getJavaSupport().handleNativeException(ite.getTargetException(), sm);