On Feb 7, 10:02 am, "David Parks" <[email protected]> wrote:
> Quick question: If a script makes a call to a java method that I have
> introduced with scope.put or with defineClass() and that method returns a
> reference to another java object which isn't otherwise in the scope chain of
> that script, what would the result be?
>
> Would the script be able to call all public methods of the returned object?
> Would it only be able to call jsGet/jsSet/jsFunction methods? Is this
> scenario simply invalid?
>
> Thanks!
> David

If the returned Java object implements a JavaScript object through
defineClass, then the process of calling defineClass on it will create
a set of JavaScript objects that will have references to the scope
passed to the defineClass call. If you use those objects in another
scope, it can have a few odd behaviors that most people won't notice
because it will refer to a different Function.prototype, for
instance.

Can you just use plain old Java objects instead of using defineClass?
Those are easier to write and understand...

--Norris
_______________________________________________
dev-tech-js-engine-rhino mailing list
[email protected]
https://lists.mozilla.org/listinfo/dev-tech-js-engine-rhino

Reply via email to