Live data from Hacker News

Java 17 / JDK 17: General Availability

mail.openjdk.java.net

101–110 of 251 posts

Re: Java 17 / JDK 17: General Availability

#101

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.

you can use lombok for generating accessors, helps to reduce a lot of boiler plate code. See https://javabydeveloper.com/project-lombok-tutorial/

I use the lombok plugin with IntelliJ, it eliminates tedious parts of some code.

Some times one needs to create new objects return multiple related items from a function. Or use a collection or array. I think it is unnecessary. Other languages (e.g. go or python) have had this for a while now. I taking a wild guess here LISP probably had it since the 1970s.

Re: Java 17 / JDK 17: General Availability

#103
I would like to ask a question, in order to elicit the detailed and considerate comment that HN is known for. It's not intended to inflammatory in any way shape or form!

I am not a Java developer. I am one of those users who has a bad memory of using Java desktop apps in ~2001 where they ate a ton of ram, seemed horrendously slow, and had example "Hello Worlds" that are reminiscent of Enterprise FizzBuzz [1]. At some point in the last 20 years, Java has gone the other way -- it has a reputation (I think) of being "boring", "performant" and used by businesses for doing server-side logic. Still, the only way I interact with it is with the occasional dependency install.

I've noticed:

-- There are a bunch of different JREs/JDKs, most famously Sun's/Oracle's own Java, OpenJDK, OpenJDK built by Other People™, and Random Other JDKs (Azul; Amazon Corretto).

-- People rail against Sun/Oracle and what happened to Java.

-- For a bloody long time I had to download the JDK separately and/or type in "agree" into a very un-friendly sounding license at the command line.

Can I therefore ask the HN meta-brain to either explain, or point me to a reference that explains:

-- What the ideological and practical differences are between the JDKs

-- Why there are different JDKs -- I get that that it's good to have different language implementations, but there are really quite a lot!

-- What Oracle did

-- And what was the beef with the whole open-source license was. Isn't opener-better?

Thank you!

[1] https://github.com/EnterpriseQualityCoding/FizzBuzzEnterpris...

Re: Java 17 / JDK 17: General Availability

#104

I've been out of the loop with the Java ecosystem, but has the transition from Java 8 to 11 completed where most of folks here work? I was also curious about large ecosystems like Hadoop and their moves from 8 to 11.

I know of a number of RHEL-based deployments we’re managing that still use Java 8. In general, if you’re developing libraries, you still need to support Java 8, because there are a significant amount of enterprise deployments that use it.

Re: Java 17 / JDK 17: General Availability

#106
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.

No more Lombok @Data annotations needed...

Re: Java 17 / JDK 17: General Availability

#107

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

Interesting but the "Isn't this just multiple return?" section seems to completely miss the point. I don't see any examples of what multiple-return would look like. And multiple-return is what I want.

At first glance, it looks like this (sure, more powerful) pattern matching system is not going to satisfy my desire for a compact syntax that lets me do the equivalent of this typescript:

    const [foo, bar] = getMeTwoThings();

Re: Java 17 / JDK 17: General Availability

#108

Reportedly, not much "big new stuff" got into this release (maybe next time), but it's an LTS so it's not the best time for that anyway.

The new FFM API looks really cool. Still incubating but having better native interop I think could really be a big win. Most developers will never touch that stuff but having the ability to manage native, off-heap memory and safely(ish) make native calls will be great.

Re: Java 17 / JDK 17: General Availability

#109

I would like to ask a question, in order to elicit the detailed and considerate comment that HN is known for. It's not intended to inflammatory in any way shape or form! I am not a Java developer. I am one of those users who has a bad memory of using Java desktop apps in ~2001 where they ate a ton of ram, seemed horrendously slow, and had example "Hello Worlds" that are reminiscent of Enterprise FizzBuzz [1]. At some…

For the most part, the various JDKs not really different. They're builds of the same OpenJDK repo.

They occasionally have a few small changes, maybe with a few extra bugfixes new or a backported.

The one small difference between compiling it yourself is that Oracle does control the TCK, a test suite for the binaries that Azul and others might use but not open to you.

Post reply on HN