From: Gergely K. <ger...@ma...> - 2010-02-28 21:57:01
|
Hi Tor, Actually, I had that exact idea back in December. I even started patching in the Android version of Harmony into xmlvm. Here are the reasons, why I decided not to continue with this approach: - I realized that porting Harmony to XMLVM was more effort than I anticipated - Harmony implements all the Java APIs from scratch, of course with some native code in the back. In XMLVM we used the power of Objective-C to reuse most of the native frameworks. For example: java_lang_String is just a typedef for NSString, java_util_ArrayList is just a typedef for NSMutableArray. This approach has the following advantages: - performance: The APIs use the native implementations with usually only a single method call overhead - transparency: For example, you can pass in a NSURL to a Java method from ObjC, and it will behave like a java_net_URI / URL without any further proxying ... etc. - code reuse: We only have to write a very thin compatibility layer above the standard frameworks. The obvious disadvantage is that we currently don't have an automated process to create this compatibility layer, all code has been written by hand so far. It would probably still make sense to reuse existing Java libraries for higher level functionality, where the standard iphone frameworks are inadequate. It would also be nice to use cross compiled versions of APIs, until "native" ones are created, but I am not sure how much work would it take to make this possible. Best Regards, Gergely 2010/2/28 Tor Lillqvist <tm...@ik...> > A general question about the Java-to-Objective-C JDK compatibility > classes in xmlvm: Currently (and in the recent suggested patches from > Gergely Kis) they are written directly in Objective-C. I wonder > whether it would be possible to instead use suitably licensed existing > Java code, and keep just the "core" parts that acually must be so, in > Objective-C. > > Obviously using stuff from OpenJDK's (i.e. Sun's, er, Oracle's) class > library is not possible or desirable because of its licensing (GPL), > but what about Apache Harmony? Is the Apache License suitable? Would > it be a good idea to just include suitable Java code from there (with > minor patches as needed) (and have xmlvm translate it into > Objective-C) instead of writing compatibility classes in Objective-C? > > (Obviously, if xmlvm itself does not want to do this, nothing prevents > an xmlvm-using project to just import such code itself. But if many > projects start doing it, there will be a large amount of duplicated > work, which is a waste of precious hacker resources.) > > --tml > -- Kis Gergely MattaKis Consulting Email: ger...@ma... Web: http://www.mattakis.com Phone: +36 70 408 1723 Fax: +36 27 998 622 |