Live data from Hacker News

Java 22 Released

mail.openjdk.org

21–30 of 178 posts

Re: Java 22 Released

#22
post #20
post #9

Foreign Function Interface is one of the key advantages what C# had over Java (e.g. against huge APIs like Android or macOS). I am really curious how this JEP turns out.

I started to tinker with this new API last week. I definitely think it's a lot better than needing to self compile a lot of the bindings yourself which will certainly bring more from the community into the feature than were here before. That said, you really need to write a bunch of boiler-plate to implement useful things in java-like paradigms in the library today. Just as an example, I wrote up a sane windows _getc…

I've been quite keen on the new FFI too - apologies if this is old news, but have you tried the [0] jextract stuff for some of the boilerplate gubbins?

[0]: https://github.com/openjdk/jextract

Re: Java 22 Released

#23
post #15

Earlier quoted context omitted.

Calling Android "Java" has always been a stretch. Not only has Android never been compatible with any version of Java, the divergence between Android and Java is only growing. JDK 22 is Java; Android is Android.

That is true, for all intents and purposes however the glue code to (insufficiently) reduce marshalling and FFI overhead is written in Java the language, even if it does not use OpenJDK.

Okay, but we're not talking about OpenJDK but about Java, a specification -- not an implementation like the OpenJDK JDK -- that Android has never conformed to and from which it is only growing further apart. I.e. the OpenJDK JDK is an implementation of Java; Android is not (there certainly may be some Java code that happens to behave the same way on Android, but it is not, and has never been, the case for Java code generally). The relationship between Java and Android is similar to that between Linux and Unix -- lots of intended similarities, but there shouldn't be an expectation that a new Linux feature appears in, say, AIX or vice-versa.

Re: Java 22 Released

#24
post #8

Interesting to see the developments on the String Templates API using the STR and fmt template processors.

It gets interesting: https://mail.openjdk.org/pipermail/amber-spec-experts/2024-M...

> concrete syntax TBB (to be bikeshod)

TIL the past participle of 'bikeshed' is 'bikeshod'. Tremendous.

Re: Java 22 Released

#25
It isn't a "Sexy" PL change, but a full foreign function interface will be a huge change. In my experience, relying on the old java JNI based libraries seems to be one of the biggest things that break in upgrades. So I am hoping this will reduce the maintenance burden of Java.

Re: Java 22 Released

#26
post #9

Foreign Function Interface is one of the key advantages what C# had over Java (e.g. against huge APIs like Android or macOS). I am really curious how this JEP turns out.

The FFI is also an artifact of CLR type system and the ability of have proper stack value based types.

They will eventually bring value types to Java with Project Valhalla.

Re: Java 22 Released

#27
post #23

Earlier quoted context omitted.

That is true, for all intents and purposes however the glue code to (insufficiently) reduce marshalling and FFI overhead is written in Java the language, even if it does not use OpenJDK.

Okay, but we're not talking about OpenJDK but about Java, a specification -- not an implementation like the OpenJDK JDK -- that Android has never conformed to and from which it is only growing further apart. I.e. the OpenJDK JDK is an implementation of Java; Android is not (there certainly may be some Java code that happens to behave the same way on Android, but it is not, and has never been, the case for Java code g…

At least they were forced to accept how much Android ecosystem depends on Java and now Java 17 LTS is the latest supported version, minus the stuff they never supported like Swing and Java 2D.

Re: Java 22 Released

#28

Earlier quoted context omitted.

"Vector API" is universal api for SIMD. It will probably remain in incubator until valhalla delivers value types.

Is there a timeline on Valhalla? I only loosely follow the Java ecosystem these days, but Valhalla is of particular interest to my performance-oriented mind.

I follow up on valhalla every now and then. It looks few more releases away, probably not before next LTS.

That being said, the amount of rigor with which the JDK devs test their experiments is really something to witness. Its equivalent to old school MS with painstaking maintenance at backwards compatibility, all the while moving the wheel of progress.

Every single change so far has been planned with a decade of advanced planning because that's just how this ecosystem roles.

Re: Java 22 Released

#30
post #9

Foreign Function Interface is one of the key advantages what C# had over Java (e.g. against huge APIs like Android or macOS). I am really curious how this JEP turns out.

It worked great for me. I had long wanted to rewrite a Python lib in Kotlin, since the Python part of the lib is slow, and it does not support multi-threading.

But the ugliness of JNI stopped me. Then I tried FFI in Java 21, with jextract it was amazing.

I wasn't aware of FFI at first, but the finalized version of virtual threads made me check the Java release notes.

Post reply on HN