Live data from Hacker News

Java 18 / JDK 18: General Availability

mail.openjdk.java.net

161–170 of 304 posts

Re: Java 18 / JDK 18: General Availability

#162

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.

With Java comes the whole JVM which is equal parts blessing and curse. You no longer need to know a bunch of OS details, but you pay in overhead. From a business standpoint, there are lots and lots of Java programmers out there. Of course that doesn't reflect anything about the average skill of those programmers..

For a typical business app, I really don’t think there is all that much overhead. Java is very fast, virtual calls are basically free due to the JIT, and these apps usually don’t need that much cache coherency for issuing an SQL query for a request. It’s not decoding video.

Re: Java 18 / JDK 18: General Availability

#163
post #87

Earlier quoted context omitted.

Just because something is a well known-flaw doesn't make it a glaring flaw. There's a reason newer JVM languages like Kotlin use == as an alias for equals instead of reference equality.

What if you are interested in reference equality?

Python uses the `is` operator, which is semantically much more explicit (and arguably correct, though C#'s use of the `is` operator is probably more correct).

edit:

Kotlin uses `===`, which is another good option.

Re: Java 18 / JDK 18: General Availability

#164

Earlier quoted context omitted.

For some purposes a tested validated binary may be appropriate vs mystery meat someone threw through a compiler then shipped without testing.

That's actually why I prefer Azul's openjdk builds over adoptopenjdk or other distros: it's sane but not in contact with the Oracle swamp https://www.azul.com/downloads/?package=jdk#download-openjdk https://hub.docker.com/r/azul/zulu-openjdk

Majority of OpenJDK code is tainted with Oracle's paycheck swap.

Re: Java 18 / JDK 18: General Availability

#165
post #18

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.

Java developers are cheap and easy to find. There are libraries for everything that you would need - AWS SDK, Redis, etc. Performance is tolerable and can be improved with things like Micronaut and native ahead of time compilation (GraalVM).

Native AOT doesn’t improve performance, but start up time and memory overhead.

Re: Java 18 / JDK 18: General Availability

#166

When is this coming to Android?

Most likely never, given Google's agenda to push Kotlin.

Android 13 is surprisingly adopting more Java 11 features, most likely because they need compatibility with Java libraries that have moved beyond the Android Java subset.

Re: Java 18 / JDK 18: General Availability

#167

Earlier quoted context omitted.

What if you are interested in reference equality?

In practice, how often are you interested in it? C# has `Object.referenceEquals()` because you _may_ want this sometimes. But to have reference equality be the default for something like `==` is a design flaw. Not one that can be fixed now, of course, but it will continue to cause bugs for years to come. Sometimes, it happens in core Java libraries themselves: https://bugs.openjdk.java.net/browse/JDK-8274779 https://…

Dunno, I do a fair bit of low level java work, happens every once in a while.

Curiously, I don't do a lot of value-comparisons. Based on grepping in the repo for my search engine, I appear to do one every 1000 lines of code. May just be how I write code though. Some people seem to do that a lot more.

Re: Java 18 / JDK 18: General Availability

#168
post #4

Here's the openjdk page which includes links to details of all new features: https://openjdk.java.net/projects/jdk/18/

This one looks interesting: "JEP 400: UTF-8 by Default": https://openjdk.java.net/jeps/400 It sounds like a good idea, but I can imagine lots of downstream breakage, some of it not immediately obvious, with apps that make bad assumptions. Edit: The risks section of the linked doc above does explain some of that, and there is some notable risk.

I wouldn't be surprised if defaulting to UTF-8 inadvertently fixes more problems than it causes.

Re: Java 18 / JDK 18: General Availability

#169

It's legitimately fascinating to see the rise of pattern matching, to the point that even Java will have it [1]! Combined with lambdas, this is a different language than the Java 1.5 that I first learned. If you would have told me that this would be valid Java code: static void testStringOrNull(Object o) { switch (o) { case null, String s -> System.out.println("String: " + s); } } I would never have believed you. And…

Everything since Java 7 has been a pleasure. The language is so much more mature now. The only problem is enterprise companies giving it a bad name, but I guess that's the price you pay for its broad usage.

Re: Java 18 / JDK 18: General Availability

#170

Any good books out there on “modern” Java that somebody would recommend?

Effective Java [0] is the Java book. It covers up to Java 9, and I expect the author will release another edition for Java 17 at some point.

Java 9-17 adds some major language features, but they're not so major that you'd really need a whole book. You could look up the individual JDK release notes and see what each release changed.

[0] https://www.oreilly.com/library/view/effective-java/97801346...

Post reply on HN