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.
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
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
javacitself… you can specify a target JRE version for your compiled output. Specify version 1.4.The IDE or
javacwill 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.