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.
Java 17 / JDK 17: General Availability
211–220 of 251 posts
Re: Java 17 / JDK 17: General Availability
#212Earlier quoted context omitted.
Still way too much typing compared to lombok's @Value @With.
This will be solved[1]: record Point(int x, int y) {} Point p = new Point(1, 2); Point pp = p with { x = 3; } [1] https://github.com/openjdk/amber-docs/blob/master/eg-drafts/...
My gut feel is that records break encapsulation and will make refactoring slightly more difficult than the equivalent lombok value class. But if this gets more people making objects immutable, I'm all for it.
Re: Java 17 / JDK 17: General Availability
#213Earlier quoted context omitted.
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] = getMeTwoThin…
I might not be aware of best practices. What are the benefits of having a multiple return type function? I just assume that one can use an object if this is needed throughout the whole code.. Or maybe create an arraylist if possible and return that?
Re: Java 17 / JDK 17: General Availability
#214This is the JDK version that ships with the wayland gui toolkits.
I’m psyched!
Re: Java 17 / JDK 17: General Availability
#215Earlier quoted context omitted.
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.
I've got a task at work to install Oracle WebLogic and migrate a legacy app from an older OAS instance. The Weblogic installer didn't even run on OpenJDK, it specifically checked for it and crashed with a "OpenJDK builds are not supported" error. No idea why that is since I read everywhere that they're essentially the same thing.
Re: Java 17 / JDK 17: General Availability
#216Earlier quoted context omitted.
TBH both approaches are just poor design of the object model. The one from my link is a clever but inefficient way to manipulate records (reflection), the one with Lombok is creating redundant interfaces without business meaning. A record with few business methods is lean enough and ensures that only valid transitions can happen.
Eh? This is pretty good: Colour changed = colour.withRed(5);
Re: Java 17 / JDK 17: General Availability
#217I'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.
Re: Java 17 / JDK 17: General Availability
#218I'm curious if it would be possible to remove null from Java. There's already support for Optional. I mean I guess a lot of code would stop compiling, or could it be deprecated somehow.
Kotlin does it, but it's next to useless because the ecosystem makes heavy use of null.
Kotlin (or any other JVM variant that does non-nullability in a seamless way) and coding guidelines should get you 90% of the way to a null-free world.
Re: Java 17 / JDK 17: General Availability
#219On 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…
Re: Java 17 / JDK 17: General Availability
#220I'm curious if it would be possible to remove null from Java. There's already support for Optional. I mean I guess a lot of code would stop compiling, or could it be deprecated somehow.
Not without changing everything in significant ways. There are two distinct kinds of types in Java: objects, including arrays, and primitives. Objects are represented as pointers, and those can be null — that's their default value. And multiple pointers can point to the same object. Primitives (int, long, boolean, char, byte, short, float, double) are "value types", they can't be null, are copied on assignment, and h…
I don't think it's a technical impossibility, but it's more likely to be solved by a JVM-based language like Kotlin than it is to get it adopted into the Java mothership.