News for hackers. Stuff that matters.
Re:Java 20: A Sneak Peek on the Panama FFM API by dr_faustus on Wednesday December 07, 2022 @07:01PM (#33902189)
Well, you certainly can use it with just an text editor. However, due to the maturity of the language and platform, the IDE support of Java is pretty much unsurpassed and you would certainly be quite a bit more productive if you used an IDE like IDEA or Eclipse.

In terms of complexity, it really depends on what you want to do. Using a powerful framework like Spring can entail some config (albeit much less than it used to). Also you would typically use a build tool like maven or gradle to manage dependencies, build artifacts, etc.. Especially maven can be a little arcane. But another major upside of the aforementioned maturity is that there are reams of docs and stackoverflow answers which will almost certainly contain solutions for any problems you might encounter.

Re:Java 20: A Sneak Peek on the Panama FFM API by TedDoesntTalk on Wednesday December 07, 2022 @08:29PM (#33902925)
> reams of docs and stackoverflow answers which will almost certainly contain solutions

This is both a blessing and a curse. Some answers and docs are decades old and although still work, are not “fashionable java” (think streams, for instance).

Re:Java 20: A Sneak Peek on the Panama FFM API by silisili on Wednesday December 07, 2022 @09:25PM (#33903313)
This is why I gave up on Java years ago. There seemed to be a lot of cruft left in the language and libraries that you were just supposed to know to not use anymore. I guess for backwards compatibility, but as a learner it's rather frustrating.

Has that gotten better recently? It's been years since I've toyed with it.

Re:Java 20: A Sneak Peek on the Panama FFM API by tadfisher on Wednesday December 07, 2022 @09:52PM (#33903524)
A lot of cruft has been split into modules, so you no longer have AWT/Swing/smartcardio/etc. in your classpath unless you want it.

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.

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
Re:Java 20: A Sneak Peek on the Panama FFM API by dotancohen on Thursday December 08, 2022 @07:58AM (#33907390)
I occasionally have to touch Java though I'm far more at home in e.g. Python. If you don't mind, a consist mention off the top of your head of things that people in my position should know about, as we Google our Java issues. I'm not cutting and pasting Stack Overflow answers, but even so they often do form the basis of ideas of the code that I write in the end. So pitfalls and modern replacements for ancient practices would be appreciated. Thank you!
Re:Java 20: A Sneak Peek on the Panama FFM API by code_runner on Wednesday December 07, 2022 @08:38PM (#33902982)
I’m new to Java so I just want to confirm… are you saying streams are or are not fashionable? Is there a better api out there?
Re:Java 20: A Sneak Peek on the Panama FFM API by yCombLinks on Wednesday December 07, 2022 @09:40PM (#33903434)
No, there are pre-streams answers, but streams are now fashionable.
Re:Java 20: A Sneak Peek on the Panama FFM API by erik_seaberg on Thursday December 08, 2022 @12:30AM (#33904549)
And streams are part of the reason checked exceptions are now unfashionable. Java doesn’t infer that a generic function arg should affect the caller’s exception signature.
Re:Java 20: A Sneak Peek on the Panama FFM API by code_runner on Thursday December 08, 2022 @05:20AM (#33906332)
Checked exceptions are the bane of my existence
Re:Java 20: A Sneak Peek on the Panama FFM API by plandis on Thursday December 08, 2022 @12:48AM (#33904651)
What’s not fashionable about streams in Java? I’ve seen many modern open source Java projects using them.
Re:Java 20: A Sneak Peek on the Panama FFM API by kaba0 on Thursday December 08, 2022 @01:30AM (#33904876)
Parent might mean it in the negative, that those answers won’t use streams.