I'm about to use a 3rd party library that makes use of JDK 5 features (like annotations and typed collections). The application I have to develop must use JDK 1.4. Do I have to expect any problems? I'm thinking of something like a method returning a List<String> but I assign the return to an 1.4-style List? The library's documentation says that one needs JDK 1.3 or above to use it, but the documentation isn't that good anyway.
I could be wrong but I dont see how the JDK 1.4 Javac can begin to understand the "new" features of 1.5, annatations it might ignore, but generics (List<String> its just not going to have a clue about.
You coudl easierly test by creating a small library using 1.5 language features and see if 1.4 handles it, as I said, i dont think it will, but could be wrong. It is total possible to take JAR's from different versions of JDK's and use them in older versions. However Generics isint a library, its a language feature which needs Javac support, so any libraries/JAR that relie on a new language feature arent going to work. (at least thats my view)
I would (try) find a JDK 1.4 version, of the library you need.
[ April 16, 2007: Message edited by: Gavin Tranter ] [ April 16, 2007: Message edited by: Gavin Tranter ]
Out of the box, it will not work. The library may be amenable to a treatment of Retroweaver, which would create a Java 1.4-compatible version - if its license allows that.
Joined: Apr 12, 2006
Okay, I took the sample application provided with the library and took a look. It used annotations to suppress warnings regarding unchecked conversions of collections. I had to remove the annotations, of course.
Then I changed some stuff concerning the typed collections and the new for-loop to make it (the sample application!) 1.4-compatible. I do get a 1.4-collection I have to treat the old-fashioned way when looping through it (casting), but I do get a List. To be more specific: the API says that getHTMLReport() returns List<String> and I do
The list is "okay" and I can loop through it. Unfortenately, I do get an error later on which is most probably unrelated to the JDK version.