Welp, looks like they'll have to skip Java 8



  • Downloaded an old sample project, got a error complaining about needing 1.5 or greater. This issue: http://stackoverflow.com/a/23815288/2063518

    static {
            javaVersion = System.getProperty("java.version");
            // version String should look like "1.4.2_10"
            if (javaVersion.indexOf("1.7.") != -1) {
                majorJavaVersion = JAVA_17;
            }
            else if (javaVersion.indexOf("1.6.") != -1) {
                majorJavaVersion = JAVA_16;
            }
            else if (javaVersion.indexOf("1.5.") != -1) {
                majorJavaVersion = JAVA_15;
            }
            else {
                // else leave 1.4 as default (it's either 1.4 or unknown)
                majorJavaVersion = JAVA_14;
            }
        }
    

  • :belt_onion:

    why would they skip java 8 due people using shitty ancient Spring versions?
    Or by "they", you mean your company/you, and by skip you mean never upgrade java again?

    Spring 2.5 has been EOLed for quite some time now, anyway.


  • Protip to anyone trying to write their own version handling code:

    • Treat unknown versions as newer than the versions you support.

    I mean, even Alien Swarm has problems with version handling - they consider any graphics card that isn't listed in the default GPU settings file to have a default of "fullscreen 640x480".

    Protip to anyone who writes version handling code that uses regular expressions or string matching of any kind:

    • Don't end your matching substring with a digit.


    • don't make assumptions about things not tied to the actual version number you're testing.

    For example, the Fallout installer refuses to install on Windows NT-based OSes. Why? Because Windows NT-based OSes obviously don't have DirectX, nor would Microsoft ever port DirectX to Windows NT. (There's literally no other reason Fallout doesn't work on Windows 2000 or XP or what-not. It doesn't require Win32, it requires DirectX. Idiots.)



  • Nah it's just some industry standard that I'm supposed to be paying lip service to. I just wanted to get a project set up with a minimum of effort, figured since there was already a sample project available on their site, it might be easier to use that than to set up my own. Figured wrong.



  • I definitely don't see the need for a version check here, considering annotations weren't even in Java 1.4. Like, they're doing this version check before trying to load something that couldn't even compile for the versions of Java that they're trying to rule out? If that was necessary, Java truly is trwtf.



  • Although that version of Spring is very old, if it works with 1.7 it should definitely work with 1.8.


  • Fake News

    While their version check is a :WTF:, the reason for the check isn't.

    Basically, the Spring authors wanted to support a range of Java versions. The main loader code was most likely compiled for Java 1.3 and Spring offered you two ways to declare your dependency injection settings: the I'm-going-to-declare-everything-in-verbose-XML-and-like-it way and the Java-5-only-magical-unicorn-annotation-wiring way. Because the XML way existed before the Java 5 annotations, even enabling support for Java 5 needed some basic XML. The error you are seeing is thus for the noobs back in the day who would pick up the sample project and would be unaware that the main XML was configured for Java 5.

    Java itself would also give errors when loading the Java 5 code without doing this check, but it wouldn't be so informative to a noob. This is one example of a Java 7 class being loaded in an older version:

    java.lang.UnsupportedClassVersionError: test_hello_world :
     Unsupported major.minor version 51.0
        at java.lang.ClassLoader.defineClass1(Native Method)
        at java.lang.ClassLoader.defineClassCond(Unknown Source)
           .........................................
    

    Also for the record, Spring 2.5 was released in 2007. The new Spring version might as well have implemented anti-gravity in that timespan.



  • @JBert said:

    Spring 2.5 was released in 2007. The new Spring version might as well have implemented anti-gravity in

    Holy shit look how much text I managed to select. Not even gonna trim it because god damn that's a lot of text for me to have selected on mobile. Wait, I was gonna say something?

    might as well have implemented anti-gravity in that time span

    Or maybe in all that time they could have implemented a better error handling system. Why don't unhandled exceptions take me straight to the solution on stack overflow (or in production, send the stack frame and relevant logs straight to our ticketing system and give the user the ticket number)? Hell, they haven't even added a magical unicorn that can wire logging in for me; still need to do Logger.getLogger(MyClassNameHolyShitWhyDoINeedToPutTheClassNameHereOhRightItsCauseTheLoggerIsStatic.class) at the top of every class.


  • Discourse touched me in a no-no place

    @Buddy said:

    still need to do Logger.getLogger(MyClassNameHolyShitWhyDoINeedToPutTheClassNameHereOhRightItsCauseTheLoggerIsStatic.class) at the top of every class

    QFT 😡


Log in to reply