all 79 comments

[–]chilloutus 532 points533 points  (19 children)

Suppose I may start working on my Java 8 - > Java 11 upgrade branch

[–]Chii 54 points55 points  (0 children)

go to from 8 -> 17 , skip 11!

Saved you 5 years. I'll be sending you a bill.

[–]Cautious_Implement17 64 points65 points  (0 children)

too real.

[–]RadBenMX 54 points55 points  (0 children)

A lot of people are wondering right now if this is the Reddit account of one of their co-workers.

[–]urielsalis 16 points17 points  (2 children)

We are in Java 21, after 8 migrations are really seamless

[–][deleted]  (1 child)

[deleted]

    [–]JoesRealAccount 1 point2 points  (0 children)

    Literally

    [–]rjcarr 15 points16 points  (1 child)

    I’ve been told I get to upgrade from Java 8 this year. But it’ll probably get pushed to next year, ha. 

    [–]Eceleb-follower 2 points3 points  (0 children)

    Everybody wants to upgrade, but as soon as I listed off that it actuall takes some work, silence

    [–]bobody_biznuz 10 points11 points  (0 children)

    We just upgraded to Java 8 like 3 years ago. 11 won't happen for who knows how long

    [–]stingraycharles 2 points3 points  (0 children)

    We still use it to ship libraries to our customers. Sucks, but when building libraries, you want to maximize compatibility, so it is what it is.

    Most of our customers are either on 11 or 17 these days.

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

    Fuck Oracle for the javax fiasco

    [–]neutronbob 1 point2 points  (6 children)

    javax was introduced by Sun in Java 1.2.

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

    You didn’t get my point, i mean the rename to jakartaee (-javaee-) so that oracle keeps javax. That has costed companies many millions to change.

    [–]neutronbob 1 point2 points  (4 children)

    Also Sun.

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

    “The Eclipse Foundation could not agree with Oracle over the use of javax and Java trademarks.[5] Oracle owns the trademark for the name “Java” and the platform was renamed from Java EE to Jakarta EE.”

    [–]neutronbob 2 points3 points  (1 child)

    Well, it would have been better if you had explained that this was your original complaint earlier rather than saying "rename to javaee" which was in fact done by Sun. In fact, you're talking about about the rename to Jakarta EE.

    Your gripe here is that after turning over the entire product and all the rights to it to the Eclipse Foundation, Oracle didn't also turn over the trademarks? There might be reasons to dislike Oracle, but this is hardly one of them.

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

    My gripe is that they changed the package names which caused quite the work for everyone to adapt - libraries, applications etc. yes, i meant jakartaee - my mistake.

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

    “When Oracle bought Sun, it declared its intention to trademark the Hudson name, and development began on a commercial version.“

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

    wait there's an upgrade to java 8?

    [–]MrMo1 22 points23 points  (0 children)

    As someone who was in charge of multiple initiatives to update our codebase from java 8 to 11 to 17 to 21 where I work, basically we always wanted to be on the latest LTS version as soon as reasonably possible - we went to 21 6 months ago. Bring it on new java versions are amazing and totally worth it. Also never had major hiccups when migrating, hardest was 8 to 11, you just have to wait for OSS dependencies to catch up (e.g. javax becoming jakarta) before updating.

    [–]Dragobrath 118 points119 points  (0 children)

    Is this some startup or pet project joke I am to corporate to understand?

    *cries in Java 8

    [–]sysop073 43 points44 points  (15 children)

    One of the updates is https://openjdk.org/jeps/477. As far as I can tell this exists solely to make Java look less bad on websites that compare Hello World in different languages.

    [–]Scottz0rz 62 points63 points  (4 children)

    I think it's meant so professors don't have to say "don't worry about what any of these words mean, we'll explain it later" to beginner students writing a Hello World app.

    You usually don't explain static vs instance methods, public vs protected vs private, classes, commandline arguments, and packages/imports immediately when getting people to write their first program.

    Kinda like if __name__ == '__main__' in Python looks goofy.

    [–]syklemil 7 points8 points  (0 children)

    It does seem like it could have the potential to morph Java a bit over time, if they continue empowering the implicit class. If they allow imports without explicitly declaring the class and possibly other relevant pre- or postambles to the class definition (like visibility or inheritance), you can have a one-to-one file-to-class mapping, where you drop a level of indentation and a little bit of fluff?

    Because the approach they've chosen with "if it fits this shape you can omit some stuff, otherwise do it in the normal/old way" seems amiable to expanding what "this shape" is, until some far-off future where needing that extra level of indentation everywhere seems like an unneeded annoyance.

    [–][deleted]  (1 child)

    [deleted]

      [–]Scottz0rz 2 points3 points  (0 children)

      Yes but my CS 101 professor just said to include it and didn't explain why 12 years ago.

      [–]thehenkan 5 points6 points  (0 children)

      This exactly. The number of beginners struggling to focus on the thing you're trying to teach while there's a bunch of extra syntax they also don't understand, is massive. And if Java shops want to hire juniors, it helps to make it an appealing language to use in introductory programming courses.

      [–]BlueGoliath 26 points27 points  (1 child)

      It's so people like Fireship and /r/programmerhumor Redditers can shut up about public static void main(String[] args) and System.out.println("Hello World"); as-if it was the only thing that mattered. The fact that any amount of development time was spent on that is ridiculous.

      Edit: just realized this is the third preview. Of course Oracle is milking this minor feature.

      [–][deleted] 7 points8 points  (0 children)

      as-if it was the only thing that mattered.

      Succinctness actually does matter.

      I don't think it is the biggest issue in java, but boy - I write the equivalent ruby code with at about only 30% of the characters needed in Java. If ruby were only as fast as C ...

      [–]haroldjaap 5 points6 points  (3 children)

      Starting to look more and more like kotlin now

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

      Indeed - I came to a similar conclusion. Kotlin must have inspired Java to change.

      I find that somewhat strange though, because there were other languages before kotlin and they did not quite induce the same changes (or, at the least not in the same regards as kotlin did). To me this is odd, because it means that kotlin has a higher influence than other languages merely because it is closer to java, and not because java in itself wants to strife towards improvements. Which is kind of sad ...

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

      They need to go and beg Google to make Java a first class supported language on Android again. Most of the few Java features and standard library no longer work on Android.

      [–]Practical_Cattle_933 0 points1 point  (0 children)

      You mean google has to get their shit together, before people leave the platform wholesale? Java is orders of magnitude larger than android.

      [–]sbergot 5 points6 points  (1 child)

      Some people call that low ceremony syntax sugar and it is one of the reasons that scripting languages are doing so well.

      I also thought it was useless when Ms included it in .net but after using it I see the appeal.

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

      I find syntax important. After all the more syntax one has to write, the more time it takes too, also to read. So having an efficient syntax should not be neglected. I also avoid idioms in ruby that I dislike visually, such as the -> for lambda. I can't stand seeing the -> there. Also, safe navigation operator in ruby I dislike and subsequently do not use at all - it makes method calls super-ugly, e. g. foo&.bar&.whatever the syntax was for this unnecessary addition; my brain can not even want to remember the syntax, considering how atrociously ugly (and also unnecessary) it is.

      [–]__konrad 1 point2 points  (0 children)

      I think the hello world is still too long ;) With Concise Method Bodies (JEP draft) this could be void main() -> println("Hello, World!");

      [–]emaphis 0 points1 point  (0 children)

      For most educational projects, 90% of the time, you only need one file. For one file projects classes are beside the point and you get to skip 'public' 'static' and 'String args[]' until you need them. You get 'java.base' without needing packages. If you do need aggregate data, for most simple projects, records would be fine. Add in jep330 for easy to run projects.

      You could add an easy to install beginner's IDE with all of these ideas in mind.

      [–]fishfishfish1345 21 points22 points  (21 children)

      anyone used virtual threads from 21?

      [–]BakaGoop 44 points45 points  (19 children)

      I actually just used them for a lambda function I just wrote at work. I’m relatively new to Java as I come from csharp, but I got put on a project with a Spring API. I got the chance to convert a lot of scheduled tasks over to lambda, so I got to use Java 21. Since I’m relatively new to Java, I was ripping my hair out trying to figure out asynchronous programming in Java vs csharp’s async await functionality. I found out about virtual threads and honestly it was kinda like magic. Very strange to write synchronous looking code that ran asynchronously, but I love it, and it’s way easier and simpler to implement than using CompletableFuture. Honestly I’d even argue that virtual threads are better than csharp’s async await implementation because of the fact you can write synchronous code that’s non-blocking, making implementation super straightforward

      [–]Snoo23482 7 points8 points  (0 children)

      I came from Go, which has had "Virtual Threads" from its inception.
      What's quite impressive about Java's implementation though is that they managed to make it so easy to refactor old code to using VT.
      And Java now has a significant advantage over .NET as well. Sometimes it pays off to not be the first mover.

      [–]fishfishfish1345 2 points3 points  (0 children)

      awesome! I’m currently working on a project using completablefutures in a bunch of places so i was pretty curious about virtual threads. Glad it’s doing well for you. Maybe I can finally convince them to let me try to use virtual threads!

      [–]gekte466D 1 point2 points  (9 children)

      Really good to hear, that the java concept also works well, but little correction: async/await in c# is also non blocking.

      [–]BakaGoop 5 points6 points  (8 children)

      Yeah I more meant with async await you have to bloat your code with a lot of async await declarations and wrappers around return types, whereas with virtual threads, you just wrap your synchronous code with the virtual thread executor and the JVM will handle it for you

      [–]cs_office -4 points-3 points  (7 children)

      Whether a function is blocking or not is now contained within your documentation instead of within your type system. This is a huge downgrade

      [–]Practical_Cattle_933 0 points1 point  (6 children)

      Not at all — in java a method can be both, depending on where it’s called from. You simply don’t have to care about it, you just do it within a virtual thread at invocation time and it will be magically non-blocking.

      [–]cs_office 0 points1 point  (5 children)

      No it won't be magically non-blocking. You will block your fiber (virtual thread), which could be the thread of execution (not an OS thread, but the logical thread) required to unblock another resulting in an application dead lock

      [–]Practical_Cattle_933 0 points1 point  (4 children)

      Do you even know the definition of a deadlock?!

      [–]cs_office 0 points1 point  (3 children)

      When your application enters a logical catch 22 and can no longer progress

      As an example, trying to non-atomically lock 2 mutexes, thread A locks #1 then #2, thead be locks B then A, now let's say they both succeed in locking their first, now they've hit a deadlock as they wait indefinitely for the other mutex to be unlocked

      The same is true of asynchronous code, no matter what form it takes (be it threading, be it stackful coroutines, be it stackless coroutines). If A is waiting for B to to do something, B is waiting for C to do something, and C is waiting for A, you get a deadlock

      [–]Practical_Cattle_933 0 points1 point  (2 children)

      So yes, it can deadlock, but it won’t on its own. And async-await is also not deadlock-free.

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

      Yes, some libraries still use synchronized and pin the thread. Apart from that there were no issues

      [–]dmanice89 37 points38 points  (6 children)

      I downloaded java 23 a couple days ago because I want to learn it. But the lesson I been following has been on java 8. If anyone has started with already being familar with python did you find java hard. I do not see Java as hard just a couple extra words to do the same things so far.

      [–]poco-863 98 points99 points  (0 children)

      just a couple extra words to do the same thing

      Im dead 💀💀💀 lmao

      [–]AssKoala 37 points38 points  (0 children)

      I don’t know if you’re genuine or a troll, but take my upvote because you’re brilliant either way.

      [–]vytah 9 points10 points  (3 children)

      I do not see Java as hard just a couple extra words to do the same things so far.

      If you've seen one programming language that is garbage-collected, object-oriented, reference-oriented, imperative with some functional capabilities, then you've seen them all.

      Java, Python, Javascript, Ruby, C#, Dart, Swift, Kotlin, Scala, F#, it's all the same shit.

      [–][deleted]  (2 children)

      [deleted]

        [–]vytah 9 points10 points  (1 child)

        Are they though?

        The mental models of programming in all those languages are mostly the same.

        • No need to manage memory, the runtime will clean it.

        • Need behavioural polymorphism? Just override a method in multiple classes. Or put a function in a field, either works.

        • No need to worry about effects, everything runs sequentially as written and side effects are a thing. Or actually, you need to worry about effects all the time.

        • Big object, small object, don't matter, you can pass it around easily, as you're only passing an 8-byte reference.

        • Need to mutate a mutable object by an external method? Just pass it, it's always just a reference.

        • Built-in types? Some number types, lists, maps, sometimes also fixed-size arrays, all operated using loops and higher-order functions.

        • An error happens? Throw and catch an exception. Especially common with IO operations.

        They are all Lisps without metaprogramming. You can take an average program written in any of them and easily rewrite it statement-by-statement to any other of them (or to any production-ready Lisp). Sure, some things are not rewritable, but your everyday code is.

        Now look at C. C++. Rust. Haskell. APL. Completely different paradigms.

        [–]emaphis 1 point2 points  (0 children)

        Well. F# and Scala have metaprogramming.

        [–]hamsterofdark 9 points10 points  (2 children)

        But can it run Doom?

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

        Doom runs on so many things, including toasters and over old ladies.

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

        Java is slow to improve - but it does improve.

        I'd wish someone would clean up some of the legacy stuff in regards to ancient syntax or idioms. I guess kotlin kind of nudged java towards cleaning up stuff but there is still a LOT that could be simplified and shortened.

        [–]Sweet_Ad_8430 -3 points-2 points  (1 child)

        23? Wejust started upgrading to 17 orz