// FIXME warning
}
final String variableName = ("@" + internedName).intern();
if (readable) {
// FIXME: should visibility be set to current visibility?
addMethod(internedName, new JavaMethod(this, PUBLIC) {
public IRubyObject call(ThreadContext context, IRubyObject self, RubyModule clazz, String name, IRubyObject[] args, Block block) {
if (args.length != 0) Arity.raiseArgumentError(runtime, args.length, 0, 0);
IRubyObject variable = self.getInstanceVariables().fastGetInstanceVariable(variableName);
return variable == null ? runtime.getNil() : variable;
}
@Override
public Arity getArity() {
return Arity.noArguments();
}
});
callMethod(context, "method_added", runtime.fastNewSymbol(internedName));
}
if (writeable) {
internedName = (internedName + "=").intern();
// FIXME: should visibility be set to current visibility?
addMethod(internedName, new JavaMethod(this, PUBLIC) {
public IRubyObject call(ThreadContext context, IRubyObject self, RubyModule clazz, String name, IRubyObject[] args, Block block) {
// ENEBO: Can anyone get args to be anything but length 1?
if (args.length != 1) Arity.raiseArgumentError(runtime, args.length, 1, 1);
return self.getInstanceVariables().fastSetInstanceVariable(variableName, args[0]);