Live data from Hacker News

Java 18 / JDK 18: General Availability

mail.openjdk.java.net

51–60 of 304 posts

Re: Java 18 / JDK 18: General Availability

#51
post #27
post #21

Earlier quoted context omitted.

That’s not an oops. You’re comparing pointers.

Still, coming from other languages, it is all too easy to write this and this silently fails without any warning. This is consistent with the rest of the language, but I'd bet one rarely wants referential equality when comparing strings. People commenting "yeah but that's because you are a newbie / you are comparing references and you should know better" miss the point I think. I can easily see myself making this mis…

Most editors will warn you about this now as soon as you type it

Re: Java 18 / JDK 18: General Availability

#52
post #27
post #21

Earlier quoted context omitted.

That’s not an oops. You’re comparing pointers.

Still, coming from other languages, it is all too easy to write this and this silently fails without any warning. This is consistent with the rest of the language, but I'd bet one rarely wants referential equality when comparing strings. People commenting "yeah but that's because you are a newbie / you are comparing references and you should know better" miss the point I think. I can easily see myself making this mis…

Linters catch this: https://rules.sonarsource.com/java/RSPEC-4973

Basically the tooling around Java is very evolved and Java static type system helps the IDEs a lot. One of the main reason enterprises prefer Java. Also majority of the tools and IDEs is free for commercial use.

Re: Java 18 / JDK 18: General Availability

#53
post #19

Earlier quoted context omitted.

Oracle's builds of Java are open source as well. The OpenJDK codebase is shared across all of the vendors that provide builds.

"Open Source" but not free to use as you wish. The Oracle builds require a commercial license.

In this case it means GPL+Classpath Exception. The link goes to the Oracle provided OpenJDK builds.

Oracle also has their own build of the JDK which is not GPL. That is free to use in commercial software as well, under their "No-Fee Terms and Conditions"

Re: Java 18 / JDK 18: General Availability

#54

This is tangential and possibly too open ended to be productive but worth a shot anyway. Why is Java so popular? I know of a major Silicon Valley company that's migrating their backend to it. Why Java over other languages? Or maybe there's not really other viable options? I'm speaking as someone who spent the last 6 years focused on frontend web technology.

For me the choice is really about the JVM, rather than going with Microsoft and .NET. I work mostly in Clojure, which runs on the JVM. But I have the whole universe of Java libraries available to me. Whatever flavor of language you are into, you will find something that runs on the JVM.

The competition includes languages like Rust, Go, Haskell or Erlang. Most of these lack the languages that you'll find on the JVM, so it really is a question of what you are trying to do. Go is certainly interesting in some places, especially if you want a binary that is entirely self sufficient. Each of these languages is interesting, though of course one has to wonder about hiring, whereas finding developers who've worked on the JVM is easy enough.

Re: Java 18 / JDK 18: General Availability

#55
post #6

Is there a reason to use Oracle's closed-source Java implementation instead of the opensource implementations? Asking as someone who's ignorant about Java. edit: per comments below, Oracle's Java is open-source too these days.

If all else has been eliminated: kickbacks perhaps?

Re: Java 18 / JDK 18: General Availability

#56

This is tangential and possibly too open ended to be productive but worth a shot anyway. Why is Java so popular? I know of a major Silicon Valley company that's migrating their backend to it. Why Java over other languages? Or maybe there's not really other viable options? I'm speaking as someone who spent the last 6 years focused on frontend web technology.

1) network effects, around runtime and core library especially. IMO, for enterprise, runtime is especially sticky. 2) of the JVM languages, Java will (always?) be the easiest to hire for

Re: Java 18 / JDK 18: General Availability

#57
post #19

Earlier quoted context omitted.

Oracle's builds of Java are open source as well. The OpenJDK codebase is shared across all of the vendors that provide builds.

"Open Source" but not free to use as you wish. The Oracle builds require a commercial license.

Maybe I'm wrong, but I don't see that called out anywhere. I don't believe that's true anymore, but correct me if I'm wrong.

For reference I double checked here: https://www.oracle.com/java/technologies/downloads/

Re: Java 18 / JDK 18: General Availability

#58
post #50
post #20

Earlier quoted context omitted.

Thanks! So why would I pick Oracle's implementation?

Ignorance of the Supreme Court decision that Java API copyrights are not enforceable. https://en.wikipedia.org/wiki/Google_LLC_v._Oracle_America,_... .

That's a separate issue. There are lots of licensed OpenJDK builds, and even for Android the case is no longer relevant as Google now licenses the API from Oracle.

Re: Java 18 / JDK 18: General Availability

#59
post #40
post #22

Earlier quoted context omitted.

The language is simple. Reasonable performance, lots of opportunities to tune that performance without changing code. Great error handling. Works across all platforms in most cases. The tooling has a long standing reputation for being incredible, given what Eclipse and Jetbrains have done for the community. It integrates nicely with native code, and is easy enough to interface with (compared to e.g. Node.js and pytho…

Great error handling? What does that mean? Checked exceptions seem cool at first, but are really just nonsense… as your only real way of dealing with this is: 1. Catch, log and rethrow, or 2. Wrap as a runtime exception (so you don’t have to change every method signature up to main()) Sure, there’s option 3: catch and handle… but this is used 1/50 times, and the ergonomics of (2) overwhelm the utility of this. BTW, v…

>> 1. Catch, log

This is not as useless as it sounds. You can analyse the logs and find out why these exceptions are occurring. A lot of times these lead you to subtle bugs which you might not have noticed otherwise.

Re: Java 18 / JDK 18: General Availability

#60

This is tangential and possibly too open ended to be productive but worth a shot anyway. Why is Java so popular? I know of a major Silicon Valley company that's migrating their backend to it. Why Java over other languages? Or maybe there's not really other viable options? I'm speaking as someone who spent the last 6 years focused on frontend web technology.

Its popular because it was popular. C#/Go/Rust/Scala/Kotlin have some advantages over Java but aren't worth switching because Java works fine. Java has been around a long time and lots of people know it.
Post reply on HN