Re:Java 20: A Sneak Peek on the Panama FFM API
by ahtihn on Thursday December 08, 2022 @01:43AM
(#33904962)
> InputStream/OutputStream
I think I missed the announcement of those being "legacy" APIs? They show up all over the place including in libraries, what is the replacement?
Re:Java 20: A Sneak Peek on the Panama FFM API
by tadfisher on Thursday December 08, 2022 @02:33AM
(#33905254)
The modern versions of these are Channel APIs in java.nio. The "N" in nio stands for "New" even though it was introduced in Java 1.4.
Re:Java 20: A Sneak Peek on the Panama FFM API
by kaba0 on Thursday December 08, 2022 @12:38PM
(#33910697)
But the old ones aren’t superseded the same way Date is, though. You are perfectly fine using them and in fact will perform similarly well due to Loom (which has actually reimplemented them on top of async APIs)
Re:Java 20: A Sneak Peek on the Panama FFM API
by ohgodplsno on Thursday December 08, 2022 @04:24AM
(#33906002)
>legacy reflection API
Did I miss something somewhere ? java.lang.reflect is still the standard way of doing Reflection.
Re:Java 20: A Sneak Peek on the Panama FFM API
by TravelPiglet on Thursday December 08, 2022 @06:42AM
(#33906842)
You can use Method Handles now for better performance in a lot of cases
A lot of cruft is still there; Date, File, InputStream/OutputStream, sun.misc.Unsafe, and the entire legacy reflection API are the bunch that stick out to me. Newer releases are actively mentioning their legacy status in documentation, and there are certainly JEPs to remove them or make them opt-in/opt-out.
If you look at OpenJDK internals, or even the foreign function/memory APIs as described in the article, it looks almost nothing like the Java I learned on and wrote for several years. Most of the Panama API is piggybacking on additions to the language made post-JDK9 or so, such as MethodHandle, VarHandle and @PolymorphicSignature methods. So I'd say the language and runtime is evolving nicely, even under the thumb of Oracle.