Thursday, December 23, 2004

Netbeans and J2SE 5.0

I have recently started porting all my apps to J2SE 5.0 (http://java.sun.com/j2se/) with the new netbeans IDE 4.0 (http://www.netbeans.org).

The Netebans IDE is really wonderful and rocks... i use a prettly old machine 550MHz with 320 MB RAM still i find it very sturdy and useful. :)

J2SE 5.0 is also having wonderful features that almost all of the java guys might be knowing now (generics, concurrency package, math enhancements, swing ++, enums, annotations etc.)

that's the good part, but the pad part is converting the pre 5.x code is a bit painful, especially if u totally rely on java.util package. I had to convert more than 200 lines of code (of the total of 20,000+ lines) using generics ... but worth it, until i came across a package that i use (not originally written by me, but modified by me) the jedit-syntax (http://v-ganesh.tripod.com/myNewSoftware.html) which uses Hashtable which contain multiple types:

Hashtable h = (key , {Hashtable | ActionListener})

the problem is that in new J2SE 5.0 i have not yet found a way to handle such a situation, without getting warning from the compiler. if some body knows a way please tell me :)

Another problem that i encountered was that for cloning:

ArrayList a = new ArrayList;
ArrayList b = a.clone(); // or even a.getClass().cast(a.clone())
// generates a warning.

as a result i had to iterate through the elements of 'a' and copy it to 'b'.

any other solutions??

No comments: