Results 1 to 6 of 6
Thread: Backwards compiling and Generics
- 07-18-2012, 07:21 PM #1
[SOLVED] Backwards compiling and Generics
I am not sure where I should place this thread. So, I stuck with the advanced Java area. I think this would have been placed in a Java Theory thread, but this forum does not have that.
I have the JDK 6 & 7 on my computer. I use them both to compile my game. The reason why I am using 6, is due to the fact that the people I want to play test my game do not have the latest version of Java, and I know that most people cannot be bothered to upgrade their Java versions or do not even know that their Java version is out of date. I could always tell them to upgrade to play the game, but I could also take the effort to compile two versions of the game.
So my simple question is; should I go back and forth, removing and replacing the generics in my code in order to get the 6 version of java to compile and to keep the 7 from throwing a warning? Should I remove all generics and suppress the warnings? Or should I just stick with JDK 7 and put a requirement to run the game as JDK 7 to run?Last edited by JosAH; 07-19-2012 at 08:15 AM.
My API:Java Code:cat > a.out || cat > main.class
- 07-18-2012, 07:54 PM #2
- Join Date
- Sep 2008
- Location
- Voorschoten, the Netherlands
- Posts
- 11,400
- Blog Entries
- 7
- Rep Power
- 17
Re: Backwards compiling and Generics
Java 1.6 has generics (aamof, Java 1.5 already had it).
kind regards,
JosWhen people rob a bank they get a penalty; when banks rob people they get a bonus.
- 07-18-2012, 08:02 PM #3
Re: Backwards compiling and Generics
Hmmm, maybe that is not my issue. I am getting an error at
The error is:Java Code:JComboBox<String> combo = new JComboBox<String>(difficutly);
This works perfectly fine when I compile it with 1.7. But this comes up when I compile it with 1.6Java Code:MainMenu.java:28: type javax.swing.JComboBox does not take parameters JComboBox<String> combo = new JComboBox<String>(difficutly); ^ MainMenu.java:28: type javax.swing.JComboBox does not take parameters JComboBox<String> combo = new JComboBox<String>(difficutly); ^ 2 errors
My API:Java Code:cat > a.out || cat > main.class
- 07-18-2012, 09:12 PM #4
- Join Date
- Sep 2008
- Location
- Voorschoten, the Netherlands
- Posts
- 11,400
- Blog Entries
- 7
- Rep Power
- 17
Re: Backwards compiling and Generics
Ah, too bad; the JComboBox class takes a type parameter in version 1.7 but it doesn't in version 1.6; I bet there are more classes that do that. I don't know an easy way out except to use the raw class in both versions.
kind regards,
JosWhen people rob a bank they get a penalty; when banks rob people they get a bonus.
- 07-19-2012, 03:27 AM #5
Re: Backwards compiling and Generics
Hmph. Well that is too bad. I guess I will stick with raw types. Its just an warning, but I was hoping that there was going to be a fix... Alright. Thank you for your time and help! Now the hard part. Figure out where the "[SOLVED]" button is.
My API:Java Code:cat > a.out || cat > main.class
- 07-19-2012, 08:16 AM #6
- Join Date
- Sep 2008
- Location
- Voorschoten, the Netherlands
- Posts
- 11,400
- Blog Entries
- 7
- Rep Power
- 17
Similar Threads
-
Nested loops, and backwards patterns
By Evildoer in forum New To JavaReplies: 5Last Post: 11-24-2012, 07:38 AM -
I need help writing an array backwards
By Brywiser in forum New To JavaReplies: 1Last Post: 12-08-2011, 12:55 AM -
reading lines from URL and printing backwards
By luxurymode in forum Advanced JavaReplies: 1Last Post: 03-30-2011, 08:18 AM -
Moving control backwards within loop in java
By jharishabh7 in forum New To JavaReplies: 16Last Post: 10-07-2010, 04:20 PM -
inputting and writing a file backwards
By jigglywiggly in forum New To JavaReplies: 0Last Post: 03-18-2009, 07:24 PM


1Likes
LinkBack URL
About LinkBacks
Reply With Quote
Bookmarks