Live data from Hacker News

Java 17 / JDK 17: General Availability

mail.openjdk.java.net

91–100 of 251 posts

Re: Java 17 / JDK 17: General Availability

#91

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.

Part of the vision of pattern matching is aggregation and destructuring [1]. This is just exploratory but may be what you're thinking about?

[1] https://github.com/openjdk/amber-docs/blob/master/site/desig...

Re: Java 17 / JDK 17: General Availability

#92

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…

Comprehensive list of all JEPs integrated since JDK 11: https://openjdk.java.net/projects/jdk/17/jeps-since-jdk-11

Here's another similar summary, but with code examples and categories.

https://advancedweb.hu/a-categorized-list-of-all-java-and-jv...

Re: Java 17 / JDK 17: General Availability

#93
post #7

Are they going to introduce zero-cost structs? Kinda like Rust guarantees that Option has the same size as T (aka free like in free beer).

It's impossible for Option to be the same size as T. Option is a tagged enum, where will the tag go?

Looks like it's only true for pointer types which cannot be null (so they can reuse null as the None tag)

https://doc.rust-lang.org/std/option/

Re: Java 17 / JDK 17: General Availability

#94

Earlier quoted context omitted.

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 work as a systems developer for a bank and records is an easy replacement for a very popular dependency called lombok. Now, records doesn't necessarily do everything that lombok does, but for us it replaces what we actually need. One less dependency and I'm a happy camper.

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).

Re: Java 17 / JDK 17: General Availability

#95
post #70
post #63

Earlier quoted context omitted.

Another license change for the official oracle jdk? What's the trap this time? :-O

I am confused by the license. The way I read it, a "bundling" with commercially licensed Software is forbidden, that is, you can't ship the JRE along with a product that you are selling. So your users will face rxtra installation steps

Or you can pay to license the JRE and include it.

Re: Java 17 / JDK 17: General Availability

#96

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.

Part of the vision of pattern matching is aggregation and destructuring [1]. This is just exploratory but may be what you're thinking about? [1] https://github.com/openjdk/amber-docs/blob/master/site/desig...

I am thinking of something more like go language or python.

In go you can do this:

function (x, y int) (sum, prod int) { return x+y, x*y }

It makes a big difference when one is using the same input to generate multiple related outputs.

Re: Java 17 / JDK 17: General Availability

#97
I understand wanting to remove the overcomplicated Security Manager, but we have one use case which, as far as I can see, has not been mentioned at https://openjdk.java.net/jeps/411 : we install a custom security manager to prevent the software, when run on a developer machine, from accidentally connecting to non-localhost network addresses (we actually use a whitelist). I wonder how we'll do that after Java 17.

Re: Java 17 / JDK 17: General Availability

#98

Earlier quoted context omitted.

I think this statement has been true since about 2014. Structs are nice, as they allow for control over locality, to a degree that is simply not possible in Java currently. But there is a second effect, which is possibly more important: If I can move gigabytes of my data into arrays of structs, then 1) I greatly reduce memory requirements (far fewer pointers), and 2) I greatly reduce the amount of work that GC has to…

Alternatively: This is such a (potentially) big change, it's important to get right. I'd be disappointed if an inadequately-baked solution gets rushed in. Another way of looking at it: This is fundamentally just a performance optimization. Java performance is already exceptional for most of Java's popular use cases (business processing). While valuable, I don't think this one feature is quite as important as you cons…

That makes sense, given the fact that they made "new Foo()" pretty lightweight anyway (for CPU, not for RAM).

Re: Java 17 / JDK 17: General Availability

#99
post #90

Earlier quoted context omitted.

Thanks for the Dev.java mention. Our team is excited to launch the site. We focused on minimal design (similar to Inside.java) and heavy on content, mostly learning material to start. More to come soon. Feedback here is welcome!

The responsiveness seems broken because of the "try java" editor. Try it on your phone and you'll see you can move the page horizontally and most of it is blank.

Thanks ya, fixing that up now.

edit: fixed

Re: Java 17 / JDK 17: General Availability

#100
post #94

Earlier quoted context omitted.

I work as a systems developer for a bank and records is an easy replacement for a very popular dependency called lombok. Now, records doesn't necessarily do everything that lombok does, but for us it replaces what we actually need. One less dependency and I'm a happy camper.

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.
Post reply on HN