Automagic property access -- and when it's a bit too magical Let's say you have a Java class with a standard getFoo/setFoo pair of methods. Rhino lets automatically unmangles the names and let you write code like this: var aFooHolder = new JavAFooHolder(); aFooHolder.foo = 'kung'; print(aFooHolder.foo); // prints 'kung' Magical! But wait, theres (unfortunately) more. Under some circumstances (what are these?) Rhino will also see private class variables. Even more unfortuantely, it seems to prefer the private member variables to the demangled property-access methods. This can bite you like a black mamba on a sunless Serengetti night. Let's say that the FooHolder?'s setFoo method has Important Side Effects: var aFooHolder = new JavAFooHolder(); aFooHolder.foo = 'kung'; // should also close the Exhaust Port leading to the reactor core print(aFooHolder.foo); // prints 'kung', because the private member variable is set correctly assertFalse(ExhaustPort.isOpen); // Augh! We're wide open to Rebel attack! This can be maddening, because the member variable appears to have been 'set' but it was really inserted with a needle. Beware!
Status: NEW → RESOLVED
Last Resolved: 11 years ago
Resolution: --- → FIXED
You need to log in before you can comment on or make changes to this bug.