NHacker Next
  • new
  • past
  • show
  • ask
  • show
  • jobs
  • submit
Java 26 is here, and with it a solid foundation for the future (hanno.codes)
ludovicianul 33 seconds ago [-]
I program in Java for more than 15 years now. I can resonate with people hating the language from it's early days due to the experience with all the enterprisy features and over abstractions. Or confunding Java with the Spring ecosystem. But Java came a long way over the years. It's now what many would call a "modern" language. It's less verbose, has many of the features people find appealing in Scala and Kotlin and it can even compile to native binaries using GraalVM. This made building CLIs in Java feasible. Or lambdas.
dzonga 51 minutes ago [-]
the people that work on Java & the JVM are very smart.

it has become a best of breed language - hell its better than Go for industry purposes.

the drawback with Java will always be the CULTURE - (maybe someone can insert a quote of how in physics progress is only made, when old physicist die - I don't wanna be morbid ) but with Java same that's when the culture will change.

All those people using typescript (could be using Java - but the culture doesn't want them and consider them heretics for not embracing religion of OOP and FactoryFactory)

mands 4 minutes ago [-]
It's getting better, it doesn't all have to be Spring Boot and JBoss.

There is quarkus, helidon and micronaut for slimmer more modern backend frameworks. jbang for scripting (think uvx, bunx), Tambo UI (https://tamboui.dev/) for terminal UIs, and more.

Along with all the new Java features that help you write much simpler code - eg. virtual threads, structured concurrency, stream gatherers, and performance / resource improvements.

It's not all there yet, but I think the next few years things will come together nicely (however a better build system is sorely needed - one of the things that Go / Rust did right).

stanac 8 minutes ago [-]
After ~13 years of working with C#, I moved to Kotlin. It's such a beautiful language. When I have to read docs for a Java lib I realize why I like Kotlin.

I want to say culture around Java doesn't have to change, new culture is growing around succinctness (if not simplicity) of Kotlin, and it gets most of the benefits of Java ecosystem.

HendrikHensen 12 minutes ago [-]
What do you mean by "better than Go for industry purposes"?

I don't understand what "industry purposes" means and in what aspects Java is better than Go in your opinion (I can think of some myself, but I'm interested in your perspective).

kyrra 33 seconds ago [-]
Not the GP, but for really large code bases, Go is missing a few features that I've noticed:

1) No immutable types. My work team is a huge user of immutable data stuctures in Java to make sure data passed around to other teams isn't changed. Go doesn't really have a good way to do this.

2) Refactoring can be really annoying (or at least really noisy) because of public/private being defined by capitalization of method/field names.

3) Error handling isn't great. I love Go's errors being just normal values, but the `error` interface is awkward when trying to figure out what kind of errors can be thrown without having in-depth knowledge of the kinds of errors that can be returned.

andyjohnson0 33 minutes ago [-]
"a solid foundation for the future" is faint praise for a language that has been around for over thirty years.

> It has become a best of breed language

To me it lags significantly behind .net (runtime) and C#/F# (language). I don't see Java catching-up.

gf000 26 minutes ago [-]
They trade blows, and have different philosophies (complex runtime, simpler language vs the reverse).

E.g. on the GC side Java is ahead of any other platform, especially with the low-latency ZGC garbage collector.

moralestapia 7 minutes ago [-]
I am captivated by your thought process.
karel-3d 44 minutes ago [-]
I didn't use Java since 7, but from people that do - nowadays you basically don't code Java, you code Spring Boot. And that has all the bad things you think when people say "Java".

I don't know if it's true though.

ivan_gammel 4 minutes ago [-]
Spring Boot isn‘t bad. It‘s opinionated about configurations and dependencies. Its main advantage is that you can start shipping production-quality code very quickly, focusing on business problems rather than anything else. Vibe coding on it is more or less stable, entire apps can be built solo in a few months. And it‘s easy to do fullstack with SSR based on Thymeleaf and Htmx. It is absolutely superior to anything that exists for node stack.

And then there‘s also Micronaut, if you prefer compile-time setup to Spring.

gf000 24 minutes ago [-]
There are more Java devs than people in my home country. Like how could you even give a single description for all of them? They all work on vastly different stuff, from low-latency trading to robotics, to regular old CRUD. Not even the CRUD part is as monotonic though as you make it out to be.
ezfe 39 minutes ago [-]
There's a lot of programming that has nothing to do with SpringBoot - and I say this as someone who works in a backend team that uses SpringBoot for all our apps.
7 minutes ago [-]
shermantanktop 32 minutes ago [-]
You're talking to specific people.

A completely different culture of Java usage can and does exist a lot of places. It is absolutely true that success creates a certain ossification of practice. But SpringBoot is not necessary, any more than Guice or any other framework-y thing.

jesse_dot_id 4 minutes ago [-]
Cool. I feel as though I'll never be able to escape 8, or ignore Ellison's legacy, unfortunately.
MeetingsBrowser 2 minutes ago [-]
> or ignore Ellison's legacy, unfortunately.

Can you elaborate?

vyskocilm 2 hours ago [-]
JEP 504: Remove the Applet API

Glad to see this being removed. Java plugins especially on Linux were awful and required by tons of corporate stuff. Anyone remeber IcedTea Web? A functional and opensource Java plugin and Java Webstart implementation?

hju22_-3 1 hours ago [-]
Remember IcedTea Web? Oh boy, I still have environments that use it.
cyberax 1 hours ago [-]
I made several Webstart corporate apps back in the day! The infrastructure was pretty neat, when it worked. And it was a whole lot better than JS back then, still in the IE6 times.
olivia-banks 3 minutes ago [-]
Really glad to see we're getting a native PEM API.
freedomben 1 hours ago [-]
As someone who has been out of the Java world for many years, but recently forced back into it due to Android dev requirements, Post lawsuit, what is the relationship between Android (Google) and Java now? When can we expect 26 on Android? On that note, why is Android always so far behind? Is it because Kotlin is primary or is it deeper? Did the lawsuit play a role?
gf000 1 hours ago [-]
Java's primary development happens on OpenJDK.

Android has their own runtime (creatively named as Android runtime), which does not run java byte code, but their own binary format. JVM class files can be compiled to that format, but the support for that always lags behind OpenJDK java versions.

Part of the reason kotlin became the de facto language on the platform was that they supported only terribly old Java at the time, that didn't even have lambdas even though it was already out.

The problem is that most of the Java libraries want to follow the desktop/server, aka the OpenJDK scene, but that would make them incompatible with Android so there was/is some incentives to bump up the version they support.

whynotmaybe 4 minutes ago [-]
I've used Java decades ago (anyone remember servlet?) and I'm glad that I can use flutter for Android development.
1 hours ago [-]
haolez 2 hours ago [-]
I was pretty surprised when I learned recently that the Java alternative for green threads doesn't use colored functions. It put Java in a higher place in my perception.
dxxvi 12 minutes ago [-]
No need of colored functions because that Java green thread returns a Future<Value> not Value like colored functions
dmos62 1 hours ago [-]
What are colored functions?
cogman10 1 hours ago [-]
Any time you have a barrier between one function being able to call another. The original article on this called them red functions and green functions. A green function can call a red function but a red function can't call a green function.

In terms of async, it's when you have to have a function with "async" attached to it and making it so that only other async functions can call async functions.

It ends up creating a weird circumstance where you can end up with a lot of duplicated APIs, particularly in libraries, because you are providing both async and non-async versions of functions.

AlotOfReading 1 hours ago [-]
The term comes from an old blog post [0] about different kinds of effect systems. Every function has a color, and every colored function can only call functions that are compatible with it, usually of the same color. The net result is that you end up either duplicating a lot of your common code so you have compatible interfaces for all the different colors (let's call that "separate but equal" if we're feeling spicy), or you end up shoving round pegs into the square holes of your dominant function color.

[0] https://journal.stuffwithstuff.com/2015/02/01/what-color-is-...

ihumanable 1 hours ago [-]
https://journal.stuffwithstuff.com/2015/02/01/what-color-is-...

The terminology is used to talk about languages that have async and sync functions where you declare (or color) the function as either async or sync.

In these languages it's pretty common for the language to enforce a constraint that async functions can only call other async functions. Javascript / Typescript, Python are popular examples of languages with colored functions.

6 minutes ago [-]
jauco 1 hours ago [-]
https://journal.stuffwithstuff.com/2015/02/01/what-color-is-...

In this context: functions anotated with async

saltyoldman 1 hours ago [-]
[flagged]
Starlevel004 1 hours ago [-]
[flagged]
antonvs 47 minutes ago [-]
No, it refers to a function that has constraints on how it can be called and composed. A classic example is functions tagged `async` in languages like Javascript or Rust.

(Technically, that's the symptom - the underlying cause is that it's a function that involves some effect, like asynchronicity, or, in some functional languages, IO.)

izacus 1 hours ago [-]
No.
antonvs 54 minutes ago [-]
Are you perhaps confusing green threads with stackless async models, like async/await? Green threads don't imply colored functions.
jayd16 26 minutes ago [-]
They said "Java alternative for green threads" so they're talking about not green threads.
Groxx 1 hours ago [-]
"green threads" is generally how I see these systems identify as "non-colored but with async-like performance" fwiw. or "fibers". otherwise it's "async" or "coroutines".
wahern 25 minutes ago [-]
There are different types of coroutines. The C++ type are sometimes called "stackless coroutines". With stackless coroutines you can't yield from a nested function call. Stackless coroutines are basically generators where you can pass arguments through resume, and async/await is effectively a form of stackless coroutines with yield/resume semantics that aren't fully generalized as coroutines, but oriented toward some bespoke notion of concurrency rather than as an abstract control flow operator.

"Stackful coroutines" allow yielding from any arbitrary point. They're basically fibers, except with the explicit control transfer and value passing yield and resume operators; there's no hidden or implicit control transfer like with green threads. Though, some people would argue allowing any function to yield without announcing this in their type signature is tantamount to hidden control transfer. Personally, I don't see how that's different than allowing any function to call other functions, or to loop, but in any event languages are free to layer on additional typing constraints--constraints that can be tailored to the desired typing semantics, rather than dictated by implementation details.

Stackless coroutines are typically implemented as a special kind of function whose state is allocated and instantiated by the caller. In contrast, stackful coroutines are typically implemented by reifying the stack, similar to threads. The "stack" may or not be the same as the system's ABI stack.

In stackful coroutines, unless there are additional typing constraints imposed by the language for hygiene reasons, any function can typically be called as a coroutine or use yield and resume. There's no need to compile functions into special alternative forms as call frame management works the same whether invoked from a coroutine context or not.

xeubie 56 minutes ago [-]
I think astronomers could measure the age of the universe in nano-Valhallas. Every year, it feels 50% closer to completion...

In all seriousness I'm happy with what Mr. Goetz and the team have done. Sealed interfaces (java 17) + exhaustive switch statements (java 21) means we now have union types in java! And instead of jumping on the async/await bandwagon we now have a more general solution that doesn't lead to API duplication (virtual threads). But Valhalla has been a veeery long time coming.

noelwelsh 48 minutes ago [-]
'Tis true. At the same time, Project Valhalla will be the most significant change to the JVM in a very long time, and probably its best chance to stay relevant in the future.
rusakov-field 15 minutes ago [-]
Ah , Java, a language I pray I never have to ever touch again.
badgersnake 1 hours ago [-]
Vector API (Eleventh Incubator) - maybe 11th time’s the charm.
mjuarez 1 hours ago [-]
When it was about the 7th incubator iteration, I got curious so I read the actual JEP history, and it had this informative tidbit, also included in the latest release:

"The Vector API will incubate until necessary features of Project Valhalla become available as preview features. At that time, we will adapt the Vector API and its implementation to use them and then promote the Vector API from incubation to preview."

Project Valhalla has been "in progress" for at least a decade now (Wikipedia say 2014). So who knows when we'll actually see a Vector API in preview.

gf000 1 hours ago [-]
On the other hand, there is a bunch of movement on Valhalla side nowadays. You can download a build and try out value types yourself!
wiseowise 2 hours ago [-]
Android as always in shambles. Shame that neither Google, nor ecosystem cares about Java because they’ve bought JetBrains kopium.
pjmlp 2 hours ago [-]
Google basically played a J++ with Android Java, with Kotlin as their .NET/C#.

At least they are forced to partially update Android Java, now Java 17 subset, so that Kotlin can keep up with was is mostly deployed at Maven Central.

cogman10 1 hours ago [-]
Pretty sure they did a J# ;). But I agree that Kotlin is their C#.

The JDK and JVM has advanced so fast while android has been lagging. It's pretty frustrating, especially because google has been so slow to pull in changes from later java versions.

A part of me wishes that android would just dump their hokey dalvik, ART, and other BS and just use the OpenJDK or a fork of the OpenJDK with whatever special sauce they need. A lot of the project Leyden stuff lends itself nicely to maybe someday being able to run real java on android.

Edit: Apparently android is forking OpenJDK, since Android 7.

https://en.wikipedia.org/wiki/Android_Nougat

pjmlp 1 hours ago [-]
J# was the transition product to port J++ into .NET, I am quite sure.

Not only I was there on those years, my employer was a MSFT partner that got to test .NET before it was announced to the world, so that we could have our products as part of the announcement event in Portugal.

OpenJDK is cherry picked, Google only picks pieces of it, rather than full compatibility.

hencq 1 hours ago [-]
J++ predates C#. It was Microsoft's version of Java that wasn't quite compatible.
cogman10 1 hours ago [-]
Correct, and J# was a brief transition language to help migrate Visual J++ applications onto the .Net SDK. J++ -> J# -> C# was the evolution.

I say J# is a more apt comparison because like Microsoft's Java, android has a substantial set of APIs that aren't part of the JDK standard. Working on Java vs Anrdoid is practically like working with the JDK vs .Net.

pjmlp 1 hours ago [-]
J++ already had those extensions, hence the lawsuit.
freedomben 1 hours ago [-]
Do you think it's legal reasons, technical reasons, NIH syndrome, or some other reason why Android doesn't use OpenJDK?
cogman10 1 hours ago [-]
A little bit of all of the above.

Android's usage of Java started right as Sun was being acquired by oracle and right before the jdk was GPLed.

... And I'll be. Apparently Android is using the OpenJDK since Android 7. [1]

[1] https://en.wikipedia.org/wiki/Android_Nougat

pjmlp 1 hours ago [-]
It isn't, check Gerrit commit history, they only take bits and pieces, plus ART doesn't do all bytecode equivalents. Some JVM bytecode don't have counterparts in Dex, rather get desugared into multiple instructions.
xxs 2 hours ago [-]
That's a proper late 90s reference, props!
cyberax 1 hours ago [-]
> Google basically played a J++ with Android Java

No, they didn't. Google happily used regular Java until Oracle played Oracle. Then Google stopped updating the supported Java language version and started diversifying away from Java.

pjmlp 1 hours ago [-]
They definitely did not, it was Android Java from day one, and Oracle should have crushed them like Sun did to Microsoft, unfortunately Google was the geek darling of do not evil, thus they got a pass from fanboys.
cyberax 50 minutes ago [-]
Android was not 100% compatible with Java, but mostly because it had a specialized environment. It did not support things like dynamic bytecode generation, but it faithfully reproduced pretty much everything else that made sense.

And yeah, it would have been so much better with Oracle(tm)(r)(c)(fuckyou) running Android with Pure Java(tm)(r)(c)(screwyou) instead. Now with EJB5 and more XML!

You might be too young to remember, but SunOracle essentially abandoned the Java language development for more than a decade, until Kotlin provided a very much needed magic kick.

Oh, and if you think _Google_ is bad for splitting the Java ecosystem, let me introduce you to J2ME and JavaCard.

sulam 1 hours ago [-]
I wouldn’t blame Google for Oracle being a lawnmower.
dxxvi 9 minutes ago [-]
Does the Java team use AI? If not, they should use it to give us more features and better performance in a release.
Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact
Rendered at 21:01:50 GMT+0000 (Coordinated Universal Time) with Vercel.