12-22-2008 03:14 PM
12-22-2008 06:46 PM
Ok... novice java programmer here (very experienced with oo, c++, other languages) so bear with me...
Just need a little guidance. I downloaded the regex java code from harmony as directed. Looking through what appear to be the most critical source files (Pattern.java, Matcher.java, a couple others) it looks like the following imports are required but not present in j2me:
Looks like I can easily replace the last one... it just looks up internationalized messages.
Regarding Serializable, my guess is that I can just remove "implements Serializable" where it appears and delete the serialization support functions (I see readObject() in Pattern.java) since I don't think I'll be needing them. Correct?
Regarding the others, they're clearly essential building blocks of the regex package so I'm guessing I'll need to find them somewhere else in the harmony source code and build them. How likey is this approach to work?
12-22-2008 11:20 PM
Started to dig in a bit and already it's not looking good. Started with java.util.ArrayList, which imports java.lang.reflect.Array. Well java.lang.reflect.Array uses generics and other features that aren't supported by the blackberry rapc.
Array.java:41: generics are not supported in -source 1.3
(try -source 1.5 to enable generics)
private static native Object multiNewArrayImpl(Class<?> componentType,
The suggestion to try -source 1.5 gives me hope even though everything I'm reading says 1.3 is the limit. Any hope here or should I look to a different regexp library? Rewriting everything to not use generics seems like too big a task...
12-23-2008 12:46 AM
12-23-2008 12:53 AM
SUCCESS! I tried getting Jakarta Oro to compile and with fairly minimal effort I was able to get it to work. I'm amazed myself actually.... I'll come back later and post more details after I clean things up but basically I had to do the following:
Replace some missing methods of the java.lang.Character class (isWhitespace(), isLetterOrDigit(), etc aren't supported).
Remove references to Serializable and Cloneable.
Remove code that uses java.util.HashMap (can be easily replaced later).
Remove some code that uses the missing Character.getType() method (can be easily replaced later).
Doing this all elegantly is going to be another challenge but I do have it working!
Thanks to all who offered advice. Probably wouldn't have tried this without your prompting.