32 ms·
Minor typo in the linked site: "JDK 20 reached General Availability on 21 March 2022" Should be 21 March 2023 Not sure who can edit that page but putting her
by barkingcat 4y ago
Minor typo in the linked site:
"JDK 20 reached General Availability on 21 March 2022"
Should be 21 March 2023
Not sure who can edit that page but putting here.
- spicybright 4y agoJust adding too, I think some of the switch statement example code is wrong: Object obj = 123L; String formatted = switch (obj) { case Integer i -> String.format("int %d", i); case Long l -> String.format("long %d", l); case Double d -> String.format("double %f", d); case String s -> String.format("String %s", s); default -> o.toString(); }; Unless I'm not understanding something, the default statement should be `obj.toString()` as `o` isn't defined.
- mdaniel 4y agoJFC, I was going to say they should have used `String.valueOf(obj)` since I expected `Object obj = null; switch (obj) { default ->` to do something sane but no, the stupid PoS NPEs because `switch` itself evidently calls `Objects.requireNonNull` The Billion Dollar Mistake meets the Power of Compounding Interest to produce an inflation adjusted number that just keeps on giving
- _old_dude_ 4y agoYou can add a 'case null' explicitly and merge it with default using 'case null, default -> ...'. See [1] for more. [1] https://openjdk.org/jeps/433 https://openjdk.org/jeps/433
- barkingcat 4y agoThis was fixed by Mark Reinhold