Live data from Hacker News

Java 18 / JDK 18: General Availability

mail.openjdk.java.net

91–100 of 304 posts

Re: Java 18 / JDK 18: General Availability

#91
post #79
post #61

Meanwhile, still using Java 8 at work

I see this everywhere. What's the excuse in your case?

not op, but in my company: all the people who wrote the systems left decades ago for better paying gigs. Broken CI/CD culture, DevOperations people are afraid to write (or unwilling to learn) IaC for deployments, must manage things by GUI (made at the time when JDK 1.8 was released). Developers are not engaged nor motivated to learn new tooling/best practices nor interested in migrating off JDK 8, since it just 'works' so why change it. Mgmt does not know much about tech so does not know that 'severe' technical rot is happening

Re: Java 18 / JDK 18: General Availability

#92
post #6

Is there a reason to use Oracle's closed-source Java implementation instead of the opensource implementations? Asking as someone who's ignorant about Java. edit: per comments below, Oracle's Java is open-source too these days.

If you have to ask, you don't need Oracle's Java.

Re: Java 18 / JDK 18: General Availability

#93
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 while it's not Elixir-level pattern matching, it's not toothless either. This is valid pattern matching code too:

    static void testTriangle(Shape s) {
        switch (s) {
            case Triangle t && (t.calculateArea() > 100) ->
                System.out.println("Large triangle");
            default ->
                System.out.println("A shape, possibly a small triangle");
        }
    }
[1]: https://openjdk.java.net/jeps/420

Re: Java 18 / JDK 18: General Availability

#94
post #4

Earlier quoted context omitted.

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.

> 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. You're not wrong, which is probably why they did it in this release. JDK 17 was an LTS release, and 18 isn't. The next LTS will be JDK 21 in September 2023: * https://www.oracle.com/java/technologies/java-se-support-roa... This presumably gives folks times to adjust bef…

Oracle is proactively suggesting to test such changes in advance, ex. https://inside.java/2021/12/10/quality-heads-up/

Re: Java 18 / JDK 18: General Availability

#95
post #16
post #8

Earlier quoted context omitted.

I'll try: Java is a proven, boring and "easy" language without much surprise, with a big standard library and ecosystem.

Java is great, but here's a surprise: if (str1 == str2) { // oops }

Only if you skip all the tutorials and don't use an editor that warns you about it. Which is another selling point for Java; it has the best editor support and quality assurance tools out there. It took years for e.g. Javascript to catch up and it's still a far cry from a proper typed language with tooling.

I mean by that same logic, Javascript will confuse you as well because `{} != {}`, or C++ because of pointer mechanisms and custom operators.

Re: Java 18 / JDK 18: General Availability

#96
post #40
post #22

Earlier quoted context omitted.

The language is simple. Reasonable performance, lots of opportunities to tune that performance without changing code. Great error handling. Works across all platforms in most cases. The tooling has a long standing reputation for being incredible, given what Eclipse and Jetbrains have done for the community. It integrates nicely with native code, and is easy enough to interface with (compared to e.g. Node.js and pytho…

Great error handling? What does that mean? Checked exceptions seem cool at first, but are really just nonsense… as your only real way of dealing with this is: 1. Catch, log and rethrow, or 2. Wrap as a runtime exception (so you don’t have to change every method signature up to main()) Sure, there’s option 3: catch and handle… but this is used 1/50 times, and the ergonomics of (2) overwhelm the utility of this. BTW, v…

Anyone not seriously considering option 3 as the default, with options 1 and 2 being the exception that one must have good reason to take, automatically disqualifies himself as ignorant of proper error handling.

Of course you catch and handle errors. Or at the very least you must think about whether it makes sense to handle an error on the current abstraction level that you are on, which means you must always consider option 3. Only if you decide that it's not possible or doesn't make sense to handle it ("I am too lazy" is not a reason to not handle it!) you decide whether you need to throw it one level up the stack. And if doing that is the sensible thing, you think about whether you want to make the exception part of the API of whatever you currently write or not. If you want to, you throw the exception without doing anything (most of the time you don't even log it, because you understand that the receiver at the end, the one who finally handles it, is responsible of logging it, otherwise you get multiple logs of the same exception written out just because someone sprinkled logging into several abstraction layers). If you want to hide the exception type somehow, you wrap it in a more fitting exception that's explicitly or implicitly part of the API of whatever you're writing, and throw that one. That can, but doesn't have to be, a runtime exception.

I really don't get what's so hard about exception handling. Java's exceptions are a pretty good analog to how one must model proper error handling in multi-layered software applications anyway, regardless of the programming model used to implement it.

Re: Java 18 / JDK 18: General Availability

#97

IntelliJ is yet to catchup it seems https://www.jetbrains.com/help/idea/supported-java-versions....

I don't think they ever supported a JDK on the day of release, they don't seem to have any sort of inside-track that would allow them to fix bugs before then.

Re: Java 18 / JDK 18: General Availability

#99

Earlier quoted context omitted.

You can get a paid commercial support license for Oracle's JDK to get an extended maintenance window. But Oracle's publicly available builds don't require a paid license. However,they only provide public builds of the current Java version. If you want LTS, you have to pay them or use another vendors builds.

That's changed a bit. As of JDK 17, Oracle offers Oracle JDK builds under the NFTC license [1], free for use in production with updates overlapping the next LTS version. [1] https://www.oracle.com/java/technologies/javase/jdk-faqs.htm...

Currently though, a lot of Java software is still java version 8 or 11 which Oracle is withholding LTS for commercial customers

Re: Java 18 / JDK 18: General Availability

#100
post #86
post #6

Is there a reason to use Oracle's closed-source Java implementation instead of the opensource implementations? Asking as someone who's ignorant about Java. edit: per comments below, Oracle's Java is open-source too these days.

Some people like support contracts. It gives you someone to blame when the auditors come knocking.

But does anyone like being involved with Oracle? There are other java vendors that offer support.
Post reply on HN