Live data from Hacker News

Java 22 Released

mail.openjdk.org

11–20 of 178 posts

Re: Java 22 Released

#11
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.

Re: Java 22 Released

#12
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...

I'm really happy they are reconsidering the syntax. Thanks for the link

Re: Java 22 Released

#13
post #2

“Vector API (Seventh Incubator)” Seven iterations? What is going on with vectors in Java?

The Foreign Memory API is in the works since 2014. They are just very diligent and careful.

Yeah, given the amount of legacy infra built on Java. They don't have the luxury to move fast and break things.

Re: Java 22 Released

#14
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.

Small correction: FFI in Android land is abysmal, to get decent performance when accessing all kinds of system APIs you almost always end up having to write helpers in Java, to try to alleviate the pain of JNI as much as possible (it is still significant).

Interop with iOS OTOH is a breeze, some of the APIs may require newer Swift Library Evolution ABI (direct calls to Swift exprots, without going through C/objC) but .NET is getting it in .NET 9 (the first and only platform to have it at the moment of release).

Re: Java 22 Released

#15
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.

Small correction: FFI in Android land is abysmal, to get decent performance when accessing all kinds of system APIs you almost always end up having to write helpers in Java, to try to alleviate the pain of JNI as much as possible (it is still significant). Interop with iOS OTOH is a breeze, some of the APIs may require newer Swift Library Evolution ABI (direct calls to Swift exprots, without going through C/objC) but…

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.

Re: Java 22 Released

#16
post #2

“Vector API (Seventh Incubator)” Seven iterations? What is going on with vectors in Java?

"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.

Re: Java 22 Released

#17
post #6
post #2

“Vector API (Seventh Incubator)” Seven iterations? What is going on with vectors in Java?

They said it is waiting for some feature from project Valhalla. Not sure which one though

There are ad-hoc hacks in the JDK to avoid allocation for vectors; once we get some Valhalla features, vectors could be represented as plain value objects.

Re: Java 22 Released

#18
post #15

Earlier quoted context omitted.

Small correction: FFI in Android land is abysmal, to get decent performance when accessing all kinds of system APIs you almost always end up having to write helpers in Java, to try to alleviate the pain of JNI as much as possible (it is still significant). Interop with iOS OTOH is a breeze, some of the APIs may require newer Swift Library Evolution ABI (direct calls to Swift exprots, without going through C/objC) but…

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.

Re: Java 22 Released

#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 _getcwd() stub and it's like 30 lines to implement correctly (properly freeing the buffer when I'm down with it)

My pet project is to see if I can write automatic stubs around calls based on published API info and sources, so that at least some of that platform binding lift isn't just for those with non-trivial knowledge of C. Well, that's the hope anyways.

Post reply on HN