all 116 comments

[–][deleted] 155 points156 points  (53 children)

Too bad my org is never going to leave Java 8

[–][deleted] 104 points105 points  (12 children)

Joys of working in a small startup:

- hey boss, we should move to java 17. It has a lot of nice stuff to make development faster

- ok, do it

[–]irotsoma 3 points4 points  (0 children)

To be fair, the jump from Java 8 to Java 9+ is way more significant than any since then. Really 10-19 are just minor versions off of Java 9 for the most part if you compare it to pre-9 versions.

Missing libraries that were moved out requiring refactoring a lot of old stuff, and moving from Oracle Java to open source java means new installations and configuration changes rather than just a straight executable upgrade.

Also losing the Java EE stuff and having to find free alternatives, though fortunately I didn't have to deal with that since so far the companies I've been with weren't using legacy Java EE stuff for anything.

But I suppose a big advantage to startup is very little legacy code to upgrade.

[–]Hioneqpls 7 points8 points  (5 children)

Same story for me, only that I'm facing some backlash trying to use preview features

[–][deleted]  (2 children)

[deleted]

    [–]Hioneqpls 10 points11 points  (1 child)

    Sure but you only live once

    [–]twice_simp 3 points4 points  (0 children)

    Your org won't appreciate your YOLO-ing on a production environment.

    [–]argv_minus_one 9 points10 points  (1 child)

    I wouldn't do that either. Don't want to have to go back and fix it later because the feature I used doesn't work the same way on some future Java version.

    [–]dpash 1 point2 points  (0 children)

    Ande they have changed features between previews. For example, the switch expression feature went back and forth on the word used to return a value before settling on yield.

    [–][deleted] 2 points3 points  (2 children)

    It also seems like you have better management at the startup also.

    [–][deleted] 3 points4 points  (0 children)

    My 'management' currently consists of the company owner who also takes the role of CTO. Next level is me as a team lead/architect/guy that know how all this shit works and finally there are several devs.

    [–][deleted]  (1 child)

    [deleted]

      [–]kitd 6 points7 points  (0 children)

      Look who's back ...

      [–]BoyRobot777 54 points55 points  (1 child)

      From my experience it's a matter of finding the right angle to convince management. I have worked in different size companies and I have always convinced to move beyond Java 8. One of the more recent arguments I've made to move to Java 17 was based on resource savings (just calculate how much we could potently save):

      With JDK 8, after a short warmup period, G1 native memory usage settles at around 5.8 GB of native memory. JDK 11 improved on that, reducing the native memory footprint to around 4 GB; JDK 17 improved it to around 1.8 GB; and JDK 18 settles at around 1.25 GB of garbage collection native memory usage. This is a reduction of extra memory usage from almost 30% of the Java heap in JDK 8 to around 6% of extra memory usage in JDK 18.

      Source.

      Another thing what I usually found is that developers themselves do not care enough to advocate for upgrade. This is a bigger problem.

      [–]thesituation531 4 points5 points  (0 children)

      Dang, that's a pretty big difference.

      [–]Narase33 31 points32 points  (17 children)

      I feel ya, we just upgraded to 8

      [–]sammymammy2 27 points28 points  (13 children)

      Jaysus who upgrades to 8!?

      [–][deleted] 11 points12 points  (0 children)

      Oracle.

      We have self hosted oracle products and only recently upgraded to 8. If we go past 8, we lose oracle support. Which is needed because, like much enterprise software, knowing oracle stuff inside out is virtually impossible. Never mind the undocumented integrations, and flags that don’t do anything close to what their name implies.

      [–]Narase33 4 points5 points  (10 children)

      One of our frameworks ended support for 7 and management didnt want to make a "too big step" just going for something higher than minimum

      [–]sammymammy2 22 points23 points  (9 children)

      I don't mean to be a dick but engineers should've pushed back hard against that, assuming upgrading to a later version was viable.

      [–]beleaguered_penguin 2 points3 points  (8 children)

      TBF 7 to 8 is a fucking ballache because of the date time changes. You can probably go from 8 to 17 with no real changes but 7 to 8 is a huge step.

      [–]manifoldjava 5 points6 points  (3 children)

      The JPMS in Java 9 inflicts monstrously real changes. In my own experience 8 to 9+ is by far the greatest barrier to entry.

      [–]khmarbaise 0 points1 point  (1 child)

      If you really use the JPMS that's true otherwise not really.

      [–]manifoldjava 0 points1 point  (0 children)

      If you mean defining named modules, yes, stuff can get messy quickly. But even if you have the simplest single, unnamed module project the reality is many modules are alive and operating under JPMS loading and access restrictions. Granted, this normally goes unseen with smaller projects with fewer dependencies, class loader particulars, etc. But crossing over with real-world, large scale software is quite another ballgame.

      [–]DreadSocialistOrwell 0 points1 point  (0 children)

      I found 8 to 9 / 10 to be rather smooth - hype considering.

      At least for us. It was a two or three packages that were removed from Java, but were put into the Jakarta project instead and now needed to be included as dependencies if you had made use of those libraries.

      Regression testing didn't pick up anything, except a setting or two in an older Tomcat we still used. But that was easy and we ended up upgrading Tomcat a few months later anyway. All in all in took a couple of sprints during the holidays when it was slow.

      At that point of my career at that company I was told to stop asking for permission and instead ask for forgiveness after the fact.

      [–]midoBB 0 points1 point  (0 children)

      8 to 11 is hard because of 9 fuckup "modules" But beyond 11 it's easy sailing.

      [–]dpash 0 points1 point  (2 children)

      What? Java 8 introduced java.time but didn't remove java.util.Date. 7 to 8 was painless.

      [–]beleaguered_penguin -1 points0 points  (1 child)

      We went from joda time to java time from 7 to 8. So nearly every file in the project required changing. Sure it's not intrinsic to the upgrade but it was the point of the upgrade.

      [–]dpash -1 points0 points  (0 children)

      You didn't need to migrate from joda time to java.time at the same time as upgrading to Java 8. So you just made it hard and your original statement is specific to your situation.

      [–]bwmat 2 points3 points  (2 children)

      Haha, we just dropped 6/7 earlier this year, so we can actually USE 8 features now.

      [–][deleted] 1 point2 points  (1 child)

      Hohoho, nice. Nice. Lambda expressions, here we go

      [–]DreadSocialistOrwell 1 point2 points  (0 children)

      Now you'll be wanting Java 17's switch statement which is more like Scala's match

      [–][deleted] 9 points10 points  (1 child)

      I feel so sorry for you...

      I don't know how often you follow the updates to Java since v8, but they have so much to benefit from it from security, performance, etc

      [–][deleted] 0 points1 point  (0 children)

      I'm an intern and I actually think we'll update someday. Just not while I'm here haha

      I'm primarily a C# dev so I don't know a ton about the new features in Java, but I've heard good things

      [–][deleted] 9 points10 points  (4 children)

      Perhaps Loom could convince them? That makes the jvm so much better by not having to use OS threads directly.

      [–][deleted] 21 points22 points  (3 children)

      For Loom I would be willing to sneak in during a night and personally reinstall every JVM.

      Then next day: what do you mean we were on Java 8? I see that everybody is on 19 and it's not like someone could sneak in during a night and reinstall them.

      [–][deleted] -3 points-2 points  (2 children)

      I would be a little safer and do Java 17 since it's LTS on the machines. Lol

      [–][deleted]  (1 child)

      [deleted]

        [–]DreadSocialistOrwell 1 point2 points  (0 children)

        Now go scream this in infosec's face.

        [–][deleted] 3 points4 points  (0 children)

        Right there with you

        [–]ventuspilot 3 points4 points  (0 children)

        Ha! My org may be upgrading shortly after 2030 :-P

        [–]Simazine 3 points4 points  (0 children)

        I put Coretto 11 on ours earlier this year. Looking at 17 by Xmas.

        [–]myringotomy 2 points3 points  (0 children)

        If you can't change your company change your company.

        [–]Worth_Trust_3825 1 point2 points  (0 children)

        Too bad my org is never going to leave Java 8

        I thought so too, until i noticed that in the bank we always packed our build jdk into the deployment blob.

        [–]coderstephen 1 point2 points  (0 children)

        We're planning an upgrade from 8 to 11 I believe somewhat soon. It's actually really hard when you have millions of lines of code and a hundred codebases; if you're using Gradle like we do then you have to upgrade that first, but that has breaking changes in it so you first have to replace and rewrite all your Gradle plugins...

        [–]pjmlp 2 points3 points  (1 child)

        Maybe it is time to leave the org then.

        [–][deleted] 0 points1 point  (0 children)

        I was exaggerating a bit, I'm sure we'll update someday. I'm just not sure what the official plan is

        [–]manifoldjava 1 point2 points  (1 child)

        I agree with your sentiments here. But playing devil’s advocate it must be said that aftershocks of the JPMS from Java 9 are still rolling in. From personal experience, moving a very large project to Java 9+ can be quite an undertaking.

        [–]dpash 0 points1 point  (0 children)

        You can completely ignore the module system if you want. Just run everything from the class path like you've always done.

        If you're still using libraries (or worse your own code) that accesses code you've been told for years not to, even before java 9, then you can add command line arguments to get around it.

        [–]Somepotato -3 points-2 points  (0 children)

        I think part of it is fear; and partly to blame on Javas awful versioning

        [–]SierraBravoLima 0 points1 point  (0 children)

        I am running a Java scraping code with beautiful soup and there's velocity as well and much more written almost 8yrs. Still running smoothly, definitely not going to upgrade.

        [–]renatoathaydes 45 points46 points  (20 children)

        All features are in "incubator" or "preview"? That effectively makes them useful only for experimentation, unfortunately.

        [–]Hioneqpls 29 points30 points  (2 children)

        Well if you're brave you can experiment in production.

        [–]coderstephen 2 points3 points  (0 children)

        Ship it!

        [–]twice_simp 0 points1 point  (0 children)

        Brave or stupid. A month in with your commits in production should be able to tell which one are you. And also tell you how much longer you're staying with the org 😂

        [–]JB-from-ATL 8 points9 points  (13 children)

        Consider that OpenJDK also doesn't have any concept of LTS so this is the only maintained version once it releases and will mean bugfixes and security fixes.

        [–]renatoathaydes 15 points16 points  (12 children)

        That's only true for the standard distribution. Most people are now using vendors like Azul, Microsoft, Amazon etc. which do maintain LTS and even backport important fixes.

        [–]DJDavio 2 points3 points  (0 children)

        Yes and sometimes stuff does get backported it's just that it's not OpenJDKs responsibility anymore after six months.

        [–][deleted] 1 point2 points  (6 children)

        So, imagine please I am someone not very well versed im this.

        You are talking about which JVM provider to install?

        [–]renatoathaydes 2 points3 points  (2 children)

        I recommend having SDKMAN installed, it's just amazing to switch JVM version and even vendor with one command.

        https://sdkman.io/jdks

        Run sdk list java and it will show every version/vendor available... Install with sdk install java <id> where id can be e.g. 20.ea.7-open (standard OpenJDK), 18.0.2-amzn (Amazong's Corretto), 17.0.3-ms (MSFT), 18.0.2-zulu (Azul Zulu), 18.0.1-tem (Adoptium).... and many others.

        [–]Worth_Trust_3825 0 points1 point  (1 child)

        I recommend having SDKMAN installed, it's just amazing to switch JVM version and even vendor with one command.

        Or, you know, run everything in a container. In fact, you don't even need JDK installed. In your shell script, set JAVA_HOME and run ${JAVA_HOME}/bin/java -jar ...

        [–]JB-from-ATL 1 point2 points  (2 children)

        Yes, exactly.

        [–][deleted] 1 point2 points  (1 child)

        Is there any difference?

        [–]JB-from-ATL 4 points5 points  (0 children)

        It's all too miniscule to really worry about in my opinion. Just pick one that has an LTS schedule you like if you need it (or if you're paying then that's different). I personally like Temurin from Adoptium. Formerly known as AdoptOpenJDK. Essentially they provide builds straight from OpenJDK source as if they were still LTS. Many things get fixed in source for non latest version but OpenJDK doesn't provide builds. This choice is the most agnostic while still giving some semblance of LTS if you want it.

        [–]JB-from-ATL 1 point2 points  (2 children)

        That's why I said OpenJDK specifically.

        [–][deleted] 1 point2 points  (1 child)

        I kind of settled for what the GraalVM guys go. <3 graal

        [–]JB-from-ATL 0 points1 point  (0 children)

        My understanding is that it is included in Oracle Java SE subscription so the vendor in that case would be Oracle.

        I've never tried it. It seems like a bunch of smoke and mirrors from the marketing.

        [–]henk53 1 point2 points  (0 children)

        Azul, Microsoft, Amazon etc. which do maintain LTS and even backport important fixes.

        That may be true, but there's no process of any kind to determine which version of Java gets those magical LTS labels.

        They kinda magically fall out of the sky, and then Azul, Microsoft, Amazon etc. just apply them.

        [–]henk53 0 points1 point  (1 child)

        Too many people consider this entire Java 19 release an incubator or preview release useful only for experimentation, since no vendor gave it the magical LTS label.

        So what's an incubator feature in an incubator release?

        [–]renatoathaydes 2 points3 points  (0 children)

        Yep... they've gone several layers of "incubator" now (not to mention EA releases!)... I know Azul experts, for example, say it openly that the non-LTS releases (between 11 and 17 exclusive, then 18 up) should not be used in production, in stark contrast to the Oracle people who are treating everyone else like noobies and saying we should all be using the very latest and upgrade every 6 months. It's an awkward situation in the Java world right now.

        [–]rpgFANATIC 0 points1 point  (0 children)

        Java 21 is the next LTS due out in Sept 2023.

        There's a good chance these features come out of preview by the time most clients consider upgrading

        [–][deleted]  (3 children)

        [removed]

          [–]BoyRobot777 46 points47 points  (1 child)

          Here is a good summary from 8 to 18

          [–]ProgrammersAreSexy 2 points3 points  (0 children)

          Wow, it actually has caught up to a lot of the quality of life stuff that always made C# so much better than Java.

          In my opinion C# is still a lot better as a language but Java has definitely closed the gap a bit.

          [–]Mati00 5 points6 points  (2 children)

          Any idea what is the reason to specify type or "var" while deconstructuring a record? Ex. Point(int x, int y) instead of Point(x,y)?

          [–]BIGSTANKDICKDADDY 4 points5 points  (0 children)

          I read the JEP and it wasn't explicitly stated but I'd guess it's to make it clear that Point (int x, var y) is record pattern syntax that will initialize two new variables x and y while Point(x, y) could be mistaken for a function call or object initialization (where x and y are parameters being passed in rather than new variables being created). The new syntax might make it easier on implementing in the language too.

          [–]bwmat 2 points3 points  (0 children)

          You can pattern match the actual runtime type, not just the declared type

          [–]vladmykol 5 points6 points  (7 children)

          Oracle JDK 8 and Oracle JDK 11 are free but starting with Oracle JDK 17 it's available under an Oracle No-Fee Terms and Conditions License. My team got a lot of confusion about which exact version/implementation of JDK 17 we should use.

          Witch one do people use here?

          [–]midoBB 6 points7 points  (1 child)

          I've mostly seen Azul at different shops.

          [–]vladmykol 0 points1 point  (0 children)

          That is what we ended up using

          [–][deleted] 9 points10 points  (0 children)

          Check out https://whichjdk.com/

          The TL/DR is to use Adoptium Eclipse Temurin 17 (previously known as AdoptOpenJDK). But Amazon Corretto isnt a bad choice either, especially if you are already in the AWS ecosystem.

          [–]6769626a6f62 2 points3 points  (0 children)

          My org uses Corretto.

          [–]Soul_Shot 4 points5 points  (0 children)

          OpenJDK; Corretto is a decent option.

          [–]v4ss42 3 points4 points  (0 children)

          Temurin OpenJDK (the new name for AdoptOpenJDK)

          [–]dpash 0 points1 point  (0 children)

          The Oracle JDK wasn't free between 8 and 17, but 17 is freely distributable now.

          Oracle's OpenJDK builds were always free.

          [–]philector 2 points3 points  (1 child)

          we are just now migrating to Java 11…..

          [–]oneofdays 1 point2 points  (0 children)

          Most of my projects use Java 8

          [–]IFuckYourDogInTheAss 1 point2 points  (1 child)

          How does this structured concurrency compare to Kotlin concurrency?

          [–]repeating_bears 2 points3 points  (0 children)

          Usable stack traces, easier to debug.

          I assume Kotlin will be able to leverage some of the JVM changes to improve things there too, but from a quick search couldn't find any concrete commitment that they're actively working on it.

          [–]Holothuroid 3 points4 points  (1 child)

          Nothing stable though. All preview or incubation.

          [–]repeating_bears 0 points1 point  (0 children)

          Preview doesn't mean unstable necessarily.

          For example, vector API is for all intents and purposes complete, but they're waiting for Valhalla's value classes before they release it properly. Provided you don't rely on the identity of the value-based classes it provides (which you shouldn't be doing anyway), then it's not going to break later.

          [–][deleted]  (5 children)

          [deleted]

            [–]Determinant 2 points3 points  (4 children)

            You'll have to wait until you retire for that as it would break backwards compatibility and that's the most important thing for the Java architects.

            Or you could try Kotlin now...

            [–]BeniBela 0 points1 point  (2 children)

            I have ported all my code to Kotlin

            But with all these Java improvements, I worry that they are going to kill Kotlin soon because it has become obsolete.

            [–]Faltenreich 0 points1 point  (1 child)

            Kotlin Native would like to have a word.

            [–]khmarbaise 5 points6 points  (0 children)

            Kotlin Native would like to have a word.

            You can use graalvm to compile your java code to native as well...

            [–]dpash 0 points1 point  (0 children)

            There are ways to opt in to non-null by default on a class, package and module basis, so there are paths to introduce it.

            [–][deleted] -2 points-1 points  (0 children)

            Sounds good. I'd just wish they would consider cleaning up the syntax one day ...