Is there a way to convert Java code that uses generics to not use generics so it works on a pre-1.5 VM?
I want to convert JBox2D to run on BlackBerry, which doesn't support generics. I would prefer not to have to convert it manually.
There's nothing I'm aware of that will automatically re-write the source code to take out generics.
However, even though you don't want to make manual changes, the process can be made easier. Using Eclipse, any other major IDE, or even command-line options for raw javac itself... you can specify a target JRE version for your compiled output. Specify version 1.4.
The IDE or javac will then display errors for every point in the code using a feature (such as generics) unsupported prior to 1.5. That will at least take you straight to the exact files and line numbers that need to change... preventing guesswork and hunting on your part.
I did not try this (as I never worked on a 1.4 or earlier VM since I started using Generics), but often heard of Retroweaver being a good tool for exactly this purpose.
It works on the class file level, not source file level, though.