I am having difficulties using Java objects as JavaScript prototypes. This illustrates my problem:
var test = {};
test.prototype = new java.util.ArrayList();
test.prototype.add(1); // works
test.add(1); // fails
It seems to me that this should never happen: any function property accessible on the prototype must be accessible on the object itself.
My goal is to add more function properties to the wrapped Java object. Is there at least a workaround to get the desired effect with Rhino? The constraint is that the adding of properties must be done on the JavaScript side.
My Rhino is 1.7R4.
var test = new java.util.ArrayList();?