I've got this piece of Java code with embedded Rhino (irrelevant bits omitted):
Context cx = Context.enter();
Scriptable scope = cx.initStandardObjects();
scope.put("foo", scope, Context.toObject(foo, scope));
ScriptableObject.putProperty(scope, "bar", Context.javaToJS(bar, scope));
where foo
extends ScriptableObject
and bar
is just a POJO without a parent.
Is there, in this particular case, any difference between the way foo
and bar
are added, or is the result the same?
I tried consulting documentation but I couldn't find any answer. Eventually I just looked up the source code (*rhino1_7R1* version) and my guess is it doesn't really matter in that scenario. Or does it?