Results 1 to 6 of 6
Like Tree1Likes
  • 1 Post By JosAH

Thread: Backwards compiling and Generics

  1. #1
    kammce's Avatar
    kammce is offline Senior Member
    Join Date
    Dec 2010
    Location
    California
    Posts
    194
    Rep Power
    5

    Question [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

  2. #2
    JosAH's Avatar
    JosAH is offline Moderator
    Join Date
    Sep 2008
    Location
    Voorschoten, the Netherlands
    Posts
    14,043
    Blog Entries
    7
    Rep Power
    23

    Default Re: Backwards compiling and Generics

    Java 1.6 has generics (aamof, Java 1.5 already had it).

    kind regards,

    Jos
    The only person who got everything done by Friday was Robinson Crusoe.

  3. #3
    kammce's Avatar
    kammce is offline Senior Member
    Join Date
    Dec 2010
    Location
    California
    Posts
    194
    Rep Power
    5

    Default Re: Backwards compiling and Generics

    Hmmm, maybe that is not my issue. I am getting an error at
    Java Code:
    JComboBox<String> combo = new JComboBox<String>(difficutly);
    The error is:
    Java 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
    This works perfectly fine when I compile it with 1.7. But this comes up when I compile it with 1.6
    My API:
    Java Code:
    cat > a.out || cat > main.class

  4. #4
    JosAH's Avatar
    JosAH is offline Moderator
    Join Date
    Sep 2008
    Location
    Voorschoten, the Netherlands
    Posts
    14,043
    Blog Entries
    7
    Rep Power
    23

    Default 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,

    Jos
    The only person who got everything done by Friday was Robinson Crusoe.

  5. #5
    kammce's Avatar
    kammce is offline Senior Member
    Join Date
    Dec 2010
    Location
    California
    Posts
    194
    Rep Power
    5

    Default 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

  6. #6
    JosAH's Avatar
    JosAH is offline Moderator
    Join Date
    Sep 2008
    Location
    Voorschoten, the Netherlands
    Posts
    14,043
    Blog Entries
    7
    Rep Power
    23

    Default Re: Backwards compiling and Generics

    I changed the title status for you; due to a 'bug' in the forum software normal users can't set their thread to a 'solved' status.

    kind regars,

    Jos
    awinston likes this.
    The only person who got everything done by Friday was Robinson Crusoe.

Similar Threads

  1. Nested loops, and backwards patterns
    By Evildoer in forum New To Java
    Replies: 5
    Last Post: 11-24-2012, 08:38 AM
  2. I need help writing an array backwards
    By Brywiser in forum New To Java
    Replies: 1
    Last Post: 12-08-2011, 01:55 AM
  3. reading lines from URL and printing backwards
    By luxurymode in forum Advanced Java
    Replies: 1
    Last Post: 03-30-2011, 08:18 AM
  4. Moving control backwards within loop in java
    By jharishabh7 in forum New To Java
    Replies: 16
    Last Post: 10-07-2010, 04:20 PM
  5. inputting and writing a file backwards
    By jigglywiggly in forum New To Java
    Replies: 0
    Last Post: 03-18-2009, 08:24 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •