Live data from Hacker News

Java 17 / JDK 17: General Availability

mail.openjdk.java.net

131–140 of 251 posts

Re: Java 17 / JDK 17: General Availability

#131

Some other news in relation to the release: - (Proposal) Moving JDK LTS versions to a two year cadence [1]. Java 21 will be next LTS instead of Java 23. - Oracle JDK is now free for commercial and production use [2]. - A new Java developer site [3]. [1] https://mreinhold.org/blog/forward-even-faster [2] https://blogs.oracle.com/java/post/free-java-license [3] https://dev.java/

> Oracle JDK is now free for commercial and production use. Hopefully, developers have learned to avoid Oracle like a plague after the last absolute licensing failure with JDK that caused all the FUD.

There are plenty of reasons to avoid Oracle, but I’m not sure what about the previous licensing change was a failure. OpenJDK builds have always been free (and provided by Oracle).

The community terribly overreacted and misunderstood the nature of that change, and indeed caused a lot of FUD.

Re: Java 17 / JDK 17: General Availability

#133
post #51

Earlier quoted context omitted.

> Language > Pattern Matching for instanceof (16) > Records (16) > Restore Always-Strict Floating-Point Semantics (17) > Sealed Classes (17) > Switch Expressions (14) > Text Blocks (15) This is what excites me. Records, switch expressions and sealed classes are all excellent and even better together. Along with pattern matching switch statements, Java is finally losing a lot of cruft people complain about.

I'm trying to find a good use case for records, but the best I can come up with is using it for composite hashmap keys. I suppose when combined with sealed classes and pattern matching features at some point it might be more useful, but what is the main use for records right now? Given that they're immutable and have no convenient way to be copied when modified, I find them quite tedious to use.

I guess records will make valhalla (value types) easier which enables more efficient data structures and will probably make passing data over FFI (valhalla) easier too.

They reduce a lot of boilerplate, e.g. when passing multiple return values.

Re: Java 17 / JDK 17: General Availability

#135

Something I would like to see in Java is for functions to return multiple (named?) values. I think it will reduce boiler plate code considerably.

I think the best thing we have is the new `record` feature. You can declare a small public record before the method with the return type, and by using the `var` keyword, the caller doesn't need to repeat the type declaration.

Re: Java 17 / JDK 17: General Availability

#136
post #94

Earlier quoted context omitted.

I think it's worth highlighting that while Lombok is a dependency it is only a compile time dependency (it's not part of the output JAR).

You say only, but I find that to be much more fussy.

Exactly, I hate dealing with Lombok projects for that reason. I'd rather the cruft than the compiler add-on.

Re: Java 17 / JDK 17: General Availability

#137
post #111

Earlier quoted context omitted.

Java tries so hard to be backwards compatible, I think null is here to stay. There is always Kotlin if you want better null safety, or compile time checks like null-away, but they are still null adjacent. Disappointing but that’s what we’re stuck with in service of backwards compatibility, but I’m not sure making these breaking changes is an improvement… look at Python 2->3 for an example

yes and most java developers have come to terms with null and NPE, it's just part of programming in Java so honestly I'm fine with it being here.

...and now that NPE has a "helpful" message, I've generally found it to be almost a non-issue these days. During development, I can usually figure out the problem immediately just from the message and I don't need to examine the stack trace.

Re: Java 17 / JDK 17: General Availability

#138

On its own, the features specifically for Java 17 aren't obviously that compelling, but the important thing is that Java 17 is an LTS, the last one of which was Java 11, 3 years ago. Since many organizations, including mine, stick to LTS releases, that means a lot of developers will get a big change in what they can do sometime in the next few months as they upgrade to the LTS. Among other things, this means that we…

Laughs because we just change to Java 8.
Post reply on HN