throw error(ruby, ex, "Could not prepare method fields: " + newClass);
} catch (NoSuchFieldException ex) {
throw error(ruby, ex, "Could not prepare method fields: " + newClass);
}
DynamicMethod method_added = new JavaMethod(rubyCls.getSingletonClass(), Visibility.PUBLIC) {
@Override
public IRubyObject call(ThreadContext context, IRubyObject self, RubyModule clazz, String name, IRubyObject[] args, Block block) {
RubyClass selfClass = (RubyClass)self;
Ruby ruby = selfClass.getClassRuntime();
String methodName = args[0].asJavaString();
Field field = allFields.get(methodName);
if (field == null) {
// do nothing, it's a non-impl method
} else {
try {
synchronized (self) {
DynamicMethod method = selfClass.searchMethod(methodName);
if (method != UndefinedMethod.INSTANCE) {
field.set(null, method);
}
}
} catch (IllegalAccessException iae) {