5 ms·
So for people (like me) who were surprised by how modern the Java code looked like… here are the following features/JEPs involved in the Java code: Finalized f
by goranmoomin 3y ago
So for people (like me) who were surprised by how modern the Java code looked like… here are the following features/JEPs involved in the Java code:
Finalized features:
- JEP 395: Records, finalized in Java 16: https://openjdk.org/jeps/395 https://openjdk.org/jeps/395
- JEP 409: Sealed Classes, finalized in Java 17: https://openjdk.org/jeps/409 https://openjdk.org/jeps/409
- JEP 441: Pattern Matching for switch, finalized in Java 21: https://openjdk.org/jeps/441 https://openjdk.org/jeps/441
Preview Language Features:
- JEP 430: String Templates, preview language feature since Java 21: https://openjdk.org/jeps/430 https://openjdk.org/jeps/430
- JEP 445: Unnamed Classes and Instance Main Methods, preview language feature since Java 21: https://openjdk.org/jeps/445 https://openjdk.org/jeps/445
- wdroz 3y agoI'm happy that JEP 441 was added to Java. // As of Java 21 Integer i = ... switch (i) { case -1, 1 -> ... // Special cases case Integer j when j > 0 -> ... // Positive integer cases case Integer j -> ... // All the remaining integers } I should stop to talk badly of Java based on my old memories of Java 6... Maybe they should do like C++ and call it modern Java.
- deleted 3y ago[deleted]