Hi again,
Is there a way to "decorate" a Java instance with a JavaScript object?
So that the JS object gets a shot at the messages sent to it before
delegating to the Java object. By a bit of Rhino hacking perhaps? Or
is at already available? (Note that this would be different from
JavaAdapter, at least I think so. Instantiate Java class, hook in JS
object on the instance to "preprocess" messages sent to the Java
instance.)
Best regards, Micke

On Feb 16, 8:58 pm, Mikael Kindborg <[email protected]> wrote:
> Hi all,
>
> I am experimenting with Rhino on Android (interpreted mode), and I
> have run into a show-stopper.
>
> When using the JavaAdapter constructor to extend a Java class, it
> seems from the stack trace, that Rhino generates byte codes, which
> then can not be loaded on Dalvik (the Android VM).
>
> Any workaround for this? The ideal solution is to generate Dalvik byte
> code, but this is a too complex undertaking for me right now. One fix
> is to write wrapper classes in Java that delegate to JavaScript
> objects, but this is a rather clumsy and non-general solution, and
> time consuming to implement, with lots of delegation methods, but I
> guess the source code could be generated off the device using
> reflection and then compiled with the application apk-file that embeds
> Rhino. Delegation is actually the technique I have been using to
> create Activities with Rhino, since the Activity class must be hard-
> coded into the Android manifest file.
>
> I recall someone developing a Clojure REPL on Android dexed the dex-
> program (which converts JVM bytes codes to Dalvik byte codes) so that
> byte code generation could run on the device.  Pretty cool and worth
> trying.
>
> Any other ideas?
>
> For those of you who are interested the project is on 
> GitHub:http://github.com/divineprog/droidscript
>
> I also write about the project on Twitter @divineprog
>
> Very best regards, Micke

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

Reply via email to