From: Gergely K. <ger...@ma...> - 2009-12-13 17:23:58
|
Hi, Currently in XMLVM trunk, the java_lang_String is defined as a typedef for NSMutableString + a category. This has the side effect, that @"Const string" is not recognized as java_lang_String, also you need to repack any NString object you get from Cocoa methods before you can pass it to cross compiled code. This is certainly suboptimal. In our branch, I changed the definiton of java_lang_String to be a typedef of NSString. Of course, the problem is that we need a mutable string in order to call the different java string constructors. So I used the following trick: 1. Added a separate alloc method for java_lang_String + (id) __alloc_java_lang_String { return [NSMutableString alloc]; } 2. Changed the XSL to use this method instead of the regular alloc, when it needs to instantiate a java_lang_String object. 3. In the Java constructors, like __init_java_lang_String_byte_ARRAYTYPE, I call the setString like this: [(NSMutableString*)self setString: s]; I plan to also submit this back for inclusion. What do you think? Are there any hidden issues that I did not consider? Best Regards, Gergely -- Kis Gergely MattaKis Consulting Email: ger...@ma... Web: http://www.mattakis.com Phone: +36 70 408 1723 |