This post originated from an RSS feed registered with Java Buzz
by Fred Grott.
Original Post: AOP in J2ME, huh?
Feed Title: ShareMe Technologies LLC-The Mobile Future
Feed URL: http://www.jroller.com/shareme/feed/entries/rss
Feed Description: A Weblog about Java programming and digital convergence on mobile devices in such areas as P2P and collaborative technology.
Recently in February of this year Tira Wireless gave some details in how they use a rewritten javassist to use AOP to transform J2ME appplicatiosn per device for porting rather than manually porting code. Now, wha tif you do nto want to rewrite Javasssist to do accomplish this feat?
Lets see lets turn ot our favorite Eclipse IDE. We have both a nice ASM and ByteOutline plugins. So why not use ASM to do the bytecode transformation instead of rewriting javassist for J2ME?
If you pretend that we are rewriting bytecode wise the MIDlet class, the byteoutline would look like this:
The ASM generated code which would produce a class file is than shown in ASM view:
What changes in the port process than for myself? That means instead of the commented code mess of preprocessing might be somewhat elimnated. You would have the bytecode transformation under CVS control and etc and thus back to knowing that it compiles the first time rather than the pick and try methods of preprocessing actions.
By avoiding manipulation at runtime we do not have to rewrite ASM for J2ME or javaassist for that matter. However, we still have to rewrite or extend ASM so that we are modifying code and inserting the modified code in the proper place. But, that is probably a better solution than a full javassist rewrite.