225226227228229230231232
InstanceFieldSetterInstaller(String name, Field field) { super(name,INSTANCE_FIELD,field); } void install(RubyModule proxy) { if (Modifier.isPublic(field.getModifiers())) { proxy.addMethod(name, new InstanceFieldSetter(name, proxy, field)); } }
122123124125126127128129130131132
String asName = fieldMap.get(key); if (asReader) module.addMethod(asName, new InstanceFieldGetter(key, module, field)); if (asWriter) { if (isFinal) throw context.getRuntime().newSecurityError("Cannot change final field '" + field.getName() + "'"); module.addMethod(asName + "=", new InstanceFieldSetter(key, module, field)); } fieldMap.remove(key); break; }
321322323324325326327328
204205206207208209210211212213214
} } else { if (asReader) module.addMethod(asName, new InstanceFieldGetter(key, module, field)); if (asWriter) { if (isFinal) throw context.getRuntime().newSecurityError("Cannot change final field '" + field.getName() + "'"); module.addMethod(asName + "=", new InstanceFieldSetter(key, module, field)); } } iter.remove(); break;
334335336337338339340341
239240241242243244245246247248249
if (asReader) module.addMethod(asName, new InstanceFieldGetter(key, module, field)); if (asWriter) { if (isFinal) { throw context.runtime.newSecurityError("Cannot change final field '" + field.getName() + "'"); } module.addMethod(asName + "=", new InstanceFieldSetter(key, module, field)); } } iter.remove(); break;
329330331332333334335336
242243244245246247248249250251252