TE
TechEcho
Home24h TopNewestBestAskShowJobs
GitHubTwitter
Home

TechEcho

A tech news platform built with Next.js, providing global tech news and discussions.

GitHubTwitter

Home

HomeNewestBestAskShowJobs

Resources

HackerNews APIOriginal HackerNewsNext.js

© 2025 TechEcho. All rights reserved.

Java 21: The Nice, the Meh, and the Momentous

279 pointsby pwpwpover 1 year ago

18 comments

adraover 1 year ago
Virtual threads are going to be great, but they&#x27;re still limited (still starved the pool when used with &#x27;synchronized&#x27; blocks), and they aren&#x27;t the structured concurrency power houses like kotlin coroutines, but its an invaluable tool that will only continue to accelerate as the ecosystem moves to adopt them.<p>Expect a lot of libraries to start release versions that are java 21 baseline because of this feature alone. We&#x27;re in for a little bit of dependency hell for the short while. Thankfully, devs have been exposed to a mostly final loom for a year, so my hope is that at least the big projects are well on their way to quick adoptions.<p>Unlike the 8-&gt;11 migration which largely brought pain, the 8-&gt;21 release brings with it a ton of value that i think will encourage most shops to actually pull the trigger and finally abandon 8.
评论 #37614540 未加载
评论 #37615713 未加载
评论 #37614515 未加载
评论 #37615110 未加载
评论 #37614606 未加载
评论 #37614684 未加载
ecshaferover 1 year ago
Java getting better pattern matching is a great change. Id really like more of the functional features to make it into Java.<p>I would love if Java pattern matching could at least get to the level of ruby pattern matching. Ruby pattern matching will allow you to deconstruct arrays and hashes to get pretty complicated patterns, which is really powerful. Right now it seems like Java might have that with a lambda in the pattern, but its not going to be as elegant as ruby where:<p>case {name: &#x27;John&#x27;, friends: [{name: &#x27;Jane&#x27;}, {name: &#x27;Rajesh&#x27;}]} in name:, friends: [{name: first_friend}, *] &quot;matched: #{first_friend}&quot; else &quot;not matched&quot; end #=&gt; &quot;matched: Jane&quot;<p>But the big change here is virtual threads which should be a game changer.
评论 #37613977 未加载
评论 #37614740 未加载
评论 #37613619 未加载
评论 #37613683 未加载
aggregatover 1 year ago
We have 2.1 million LOC in Java and we&#x27;re moving to Java 21 (from 17) in two weeks when we branch for release.<p>We have a hundreds of third party dependencies across the code base, a lot of the big ones (Hibernate, Spring, a lot of Apache). We write a big web application and maintain a big legacy desktop application in Swing.<p>We run a dedicated nightly CI job that is on the latest Java release to get early warning for any incompatibilities. After the painful migration from 8 to 9 so many years ago it has been smooth sailing.<p>In all those version upgrades over all those years and dozens of on premise installations with big customers we have never had a regression or a problem that was caused by the runtime itself.
PaulHouleover 1 year ago
(1) It&#x27;s a bit of a bad smell (which he points out) that records aren&#x27;t being used much at all in the Java stdlib, I wrote something that built out stubs for the 17 and 18 stdlibs and that stood out like a sore thumb. I do like using records though.<p>(2) I&#x27;ve looked at other ways to extend the collections API and related things, see<p><a href="https:&#x2F;&#x2F;github.com&#x2F;paulhoule&#x2F;pidove">https:&#x2F;&#x2F;github.com&#x2F;paulhoule&#x2F;pidove</a><p>and I think the sequenced collections could have been done better.<p>(3) Virtual Threads are kinda cool but overrated. Real Threads in Java are already one of the wonders of the web and perform really well for most applications. The cases where Virtual Threads are really a win will be unusual but probably important for somebody. It&#x27;s a good thing it sticks to the threads API as well as it did because I know in the next five years I&#x27;m going to find some case where somebody used Virtual Threads because they thought it was cool and I&#x27;ll have to switch to Real Threads but won&#x27;t have a hard time doing so.
评论 #37616266 未加载
评论 #37615953 未加载
评论 #37618403 未加载
评论 #37616972 未加载
Vicinity9635over 1 year ago
The examples having to word wrap in a tiny text box look even more absurd and unreadable when the page is only using 1&#x2F;3rd of the screen.<p>What is with this awful formatting? <a href="https:&#x2F;&#x2F;i.imgur.com&#x2F;nQmt7Qo.png" rel="nofollow noreferrer">https:&#x2F;&#x2F;i.imgur.com&#x2F;nQmt7Qo.png</a>
评论 #37664689 未加载
marginalia_nuover 1 year ago
&gt; Miscellaneous new methods -- meh<p>Dunno, several of these are tangible QoL boosts:<p>Math.clamp(), List.reversed(), List.addFirst(), List.addLast(), Character.isEmoji()
评论 #37619823 未加载
评论 #37614003 未加载
hinkleyover 1 year ago
What&#x27;s the Scala community think about this development? I would think this would affect them quite a lot.<p>Google is not helping.
评论 #37620140 未加载
评论 #37619220 未加载
评论 #37618185 未加载
Someone1234over 1 year ago
If you&#x27;re viewing that website on a desktop, I strongly suggest removing max-width: 90ch from the body css. Instead of 50% white space, it goes full width and makes the table substantially more readable (particularly the code samples).
评论 #37614613 未加载
评论 #37621434 未加载
anonymousDanover 1 year ago
Can anyone explain this comment: &quot;In the past, a thread pool didn&#x27;t just throttle the incoming requests but also the concurrent resources that your app consumed. If you now accept many more incoming requests, you may need other ways to manage resource consumption.&quot;
评论 #37618809 未加载
评论 #37618167 未加载
mrkeenover 1 year ago
In the code example for virtual threads, I have no idea what will happen in parallel.<p>How do I reason about the order in which the calls change the state of the world?
评论 #37614694 未加载
logicchainsover 1 year ago
Does anyone know if Java virtual threads will also have channels and a select concept, like in Go?
评论 #37620803 未加载
评论 #37617815 未加载
评论 #37621124 未加载
ivanjermakovover 1 year ago
I love pattern matching, but without a proper support for variant types it won&#x27;t be as useful as it could.<p>I&#x27;m aware of `permits` clause, but it&#x27;s not good enough.
sylwareover 1 year ago
I am looking for assembly implemented JVMs (x86_64&#x2F;risc-v&#x2F;etc), that to remove SDK pressure and give stable auditability of machine code.<p>Do those exist?
bullenover 1 year ago
So it&#x27;s just Thread.startVirtualThread(runnable); that&#x27;s it?<p>Going to be interesting!
billfruitover 1 year ago
Does it add stdint style names for integer types, unsigned integer types etc?
评论 #37614945 未加载
评论 #37615979 未加载
hoistbypetardover 1 year ago
It sounds like it has some neat new features. But I&#x27;ll never know because I&#x27;m never again going to use another Oracle thing. There&#x27;s not a thing they could make that&#x27;s good enough for me to agree to one of their EULAs and install it. Their behavior in that area is just staggeringly bad.
评论 #37619318 未加载
评论 #37621131 未加载
baqover 1 year ago
<p><pre><code> &gt; &quot;Hello, World!&quot;.splitWithDelimiters &gt; (&quot;\\pP\\s\*&quot;, -1) &gt; &#x2F;&#x2F; [&quot;Hello&quot;, &quot;, &quot;, &quot;World&quot;, &quot;!&quot;, &quot;&quot;] </code></pre> &gt; Meh<p>My brain just melted.
评论 #37616760 未加载
waynesonfireover 1 year ago
&gt; Over 10,000 bug fixes<p>Most of which were likely introduced during new feature development in recent releases. To suggest that this on its own somehow manifests a more stable jdk compared to some ancient, battle tested version of the jdk is debatable.<p>I find it rather concerning that so many bugs exist to begin with. Why are these not caught sooner?<p>Has the whole world gone crazy? Am I the only one around here who gives a shit about quality? Mark it zero!
评论 #37616616 未加载
评论 #37623745 未加载
评论 #37616618 未加载
评论 #37620143 未加载