aspose file tools*
The moose likes Java in General and the fly likes Problem going from 1.5 to 1.4.2 Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Soft Skills this week in the Jobs Discussion forum!
JavaRanch » Java Forums » Java » Java in General
Bookmark "Problem going from 1.5 to 1.4.2" Watch "Problem going from 1.5 to 1.4.2" New topic
Author

Problem going from 1.5 to 1.4.2

Rob Marshall
Ranch Hand

Joined: Aug 17, 2009
Posts: 30
Hi,

This is probably a really dumb question, but I'm not sure what to do with this. I'm relatively new to Java and I had written some stuff using 1.5 (that's working just fine) but I have to run it on a 1.4.2 system. Below is a simplified example of one of the problems and it has to do with HashMaps. The 1.5 code is:

When I try to compile this on 1.4.2 it complains about the <String, ...> bits. So I took them out but then when I try to compile it I get:

I'm assuming that this is probably something really simple, but I don't know what it is. Any ideas?

Thanks,

Rob
Sebastian Janisch
Ranch Hand

Joined: Feb 23, 2009
Posts: 1183
You need to get rid of all the generic type declaration you use with you Maps, List etc.

These were introduced in Java 1.5

So instead of



you need to use this syntax




JDBCSupport - An easy to use, light-weight JDBC framework -
Rob Marshall
Ranch Hand

Joined: Aug 17, 2009
Posts: 30
Hi Sebastian,

Thanks for the quick response, but what it's complaining about is the get(). Even if I do:


It still complains about:

So the problem seems to be with the get() method for the HashMap, not with the type of the data being returned/gotten.

Rob
Rob Marshall
Ranch Hand

Joined: Aug 17, 2009
Posts: 30
Actually, what I have to do is (and again, thanks for the tip because it got me thinking...):

I had originally made the assumption (bad as it turns out) that it was the first get(), when it was actually the second one that it was complaining about.

Thanks again,

Rob
David Newton
Author
Rancher

Joined: Sep 29, 2008
Posts: 12617

You should check the 1.4 API docs then.

Another option is to use something like retroweaver/retrotranslator which AFAIK will convert essentially all 1.5 bytecode to be 1.4-compatible, but you'd have to try it.
Rob Marshall
Ranch Hand

Joined: Aug 17, 2009
Posts: 30
Hi David,

Thanks for the information about retroweaver/retrotranslator. I have retrotranslator working and everything seems to be fine (hallelujah! I was really dreading have to track down all the stuff I'd have to change...). I wasn't able to build retroweaver, the ant build.xml (I think it's actually the build.properties) is set up for Windows and not Linux so it doesn't find the 1.4 JVM even when I change the build.properties file. Right now I don't feel like messing with it. Maybe I'll get back to it later...unless someone here knows of a build.Linux.properties for it

Thanks again,

Rob
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Problem going from 1.5 to 1.4.2