Win a copy of Testing JavaScript Applications this week in the HTML Pages with CSS and JavaScript forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Bear Bibeault
  • Ron McLeod
  • Jeanne Boyarsky
  • Paul Clapham
Sheriffs:
  • Tim Cooke
  • Liutauras Vilda
  • Junilu Lacar
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • fred rosenberger
  • salvin francis
Bartenders:
  • Piet Souris
  • Frits Walraven
  • Carey Brown

Problem going from 1.5 to 1.4.2

 
Ranch Hand
Posts: 30
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
Ranch Hand
Posts: 1183
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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



 
Rob Marshall
Ranch Hand
Posts: 30
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 30
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
Author
Posts: 12617
IntelliJ IDE Ruby
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 30
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
    Bookmark Topic Watch Topic
  • New Topic