private static void appendFeaturesToClass(ThreadContext context, IRubyObject self, final RubyClass clazz) { Ruby runtime = context.runtime; checkAlreadyReified(clazz, runtime); IRubyObject javaClassObj = Helpers.getInstanceVariable(self, runtime, "@java_class"); IRubyObject javaInterfaces; if (!clazz.hasInstanceVariable("@java_interfaces")) { javaInterfaces = RubyArray.newArray(runtime, javaClassObj); Helpers.setInstanceVariable(javaInterfaces, clazz, "@java_interfaces"); initInterfaceImplMethods(context, clazz); } else { javaInterfaces = Helpers.getInstanceVariable(clazz, runtime, "@java_interfaces"); // we've already done the above priming logic, just add another interface // to the list of intentions unless we're past the point of no return or // already intend to implement the given interface if (!(javaInterfaces.isFrozen() || ((RubyArray)javaInterfaces).includes(context, javaClassObj))) { ((RubyArray)javaInterfaces).append(javaClassObj); } } }
private static void appendFeaturesToClass(ThreadContext context, final IRubyObject self, final RubyClass clazz) { final Ruby runtime = context.runtime; checkAlreadyReified(clazz, runtime); final JavaClass javaClass = getJavaClassForInterface(self); RubyArray javaInterfaces; if ( ! clazz.hasInstanceVariable("@java_interfaces") ) { javaInterfaces = RubyArray.newArray(runtime, javaClass); clazz.setInstanceVariable("@java_interfaces", javaInterfaces); initInterfaceImplMethods(context, clazz); } else { javaInterfaces = (RubyArray) clazz.getInstanceVariable("@java_interfaces"); // we've already done the above priming logic, just add another interface // to the list of intentions unless we're past the point of no return or // already intend to implement the given interface if ( ! ( javaInterfaces.isFrozen() || javaInterfaces.includes(context, javaClass) ) ) { javaInterfaces.append(javaClass); } } }
private static void appendFeaturesToClass(ThreadContext context, IRubyObject self, final RubyClass clazz) { Ruby runtime = context.runtime; checkAlreadyReified(clazz, runtime); IRubyObject javaClassObj = Helpers.getInstanceVariable(self, runtime, "@java_class"); IRubyObject javaInterfaces; if (!clazz.hasInstanceVariable("@java_interfaces")) { javaInterfaces = RubyArray.newArray(runtime, javaClassObj); Helpers.setInstanceVariable(javaInterfaces, clazz, "@java_interfaces"); initInterfaceImplMethods(context, clazz); } else { javaInterfaces = Helpers.getInstanceVariable(clazz, runtime, "@java_interfaces"); // we've already done the above priming logic, just add another interface // to the list of intentions unless we're past the point of no return or // already intend to implement the given interface if (!(javaInterfaces.isFrozen() || ((RubyArray)javaInterfaces).includes(context, javaClassObj))) { ((RubyArray)javaInterfaces).append(javaClassObj); } } }
private static void appendFeaturesToClass(ThreadContext context, final IRubyObject self, final RubyClass clazz) { final Ruby runtime = context.runtime; checkAlreadyReified(clazz, runtime); final JavaClass javaClass = getJavaClassForInterface(self); RubyArray javaInterfaces; if ( ! clazz.hasInstanceVariable("@java_interfaces") ) { javaInterfaces = RubyArray.newArray(runtime, javaClass); clazz.setInstanceVariable("@java_interfaces", javaInterfaces); initInterfaceImplMethods(context, clazz); } else { javaInterfaces = (RubyArray) clazz.getInstanceVariable("@java_interfaces"); // we've already done the above priming logic, just add another interface // to the list of intentions unless we're past the point of no return or // already intend to implement the given interface if ( ! ( javaInterfaces.isFrozen() || javaInterfaces.includes(context, javaClass) ) ) { javaInterfaces.append(javaClass); } } }