Java 26 Is Here, And With It a Solid Foundation for the Future
26 points by ubernostrum
26 points by ubernostrum
I was really hoping for Structured Concurrency to stabilize, but I guess they want to take their time because this will be how everyone ends up adding cheap concurrency in future.
All in all, Java releases are really cool these days. Solid back-compat, and unlike Go the language is very expressive.
Go must be doing something right if it’s the language everyone feels they have to (snarkily) compare every other language to. 🤷♂️
Not a Java person historically, but I keep finding myself nodding at these release posts lately. The language is getting the features it needed without the kind of churn that makes you feel like you're chasing a moving target. I'm at the point of wondering whether I'd actually miss Kotlin if I just used Java 26 for something. Though I suspect I'd find reasons to complain the moment I sat down to write real code.
Calling
var client = HttpClient.newHttpClient();
var request = HttpRequest.newBuilder(URI.create("https://hanno.codes")).GET().build();
var response = client.send(request, HttpResponse.BodyHandlers.ofString());
Easy to use is crazy to me, this API is everything BUT easy to use
all things are relative, it used to be much more verbose:
var u = new URL("https://hanno.codes");
var conn = (HttpURLConnection)u.openConnection();
int code = conn.getResponseCode();
// check it for legal ones, be careful about setInstanceFollowRedirects(true)
try (var stream = conn.getInputStream()) {
// do the stream dance
} finally {
conn.close();
}
and I don't think the cited snippet needs the variables for that specific invocation, which would further cut down on some noise
I grant you it's not from urllib.request import urlopen but nor is it what I am sure would be worse in C++ either
in general, looks pretty good. happy about
more pattern-matching stuff. however, it's just so java to name a thing newVirtualThreadPerTaskExecutor lol.
I dunno.. Verbose naming has kind of grown on me. I like terseness as much as anybody, but the load-bearing multi-decade-long codebases that are Java's bread and butter the verbosity is a major plus.
The old crap of HammerFactoryFactoryFactory is thankfully rare. Now all we need to do is get people to start using records instead of generating gazillian getter/setters.
true and true. I'll rather take something that's explicitly named compared to something like strpbrk. And yes, records are awesome. I'm trying to use them whenever I can instead of making a custom class.