You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+116-1Lines changed: 116 additions & 1 deletion
Original file line number
Diff line number
Diff line change
@@ -2,7 +2,9 @@ Here's your text with grammar and spelling corrections:
2
2
3
3
# Hello, Java 22
4
4
5
-
Hi, Spring fans! Happy [Java 22](https://blogs.oracle.com/java/post/the-arrival-of-java-22) release day, to those who celebrate! Did you get the bits already? Go, go, go! Java 22 is a _significant_ improvement that I think is a worthy upgrade for everyone. I love Java 22, and of course, I love GraalVM, and both have releases today! Java is of course our favorite runtime and language, and GraalVM is a high-performance JDK distribution that supports additional languages and allows ahead-of-time (AOT) compilation (they're called GraalVM native images). GraalVM includes all the niceties of the new Java 22 release, with some extra utilities, so I always recommend just downloading that one. I'm interested, specifically, in the GraalVM native image capability. The resulting binaries start almost instantly and take considerably less RAM compared to their JRE cousins. GraalVM isn't new, but it's worth remembering that Spring Boot has a great engine to support turning your Spring Boot applications into GraalVM native images.
5
+
Hi, Spring fans! Happy [Java 22](https://blogs.oracle.com/java/post/the-arrival-of-java-22) release day, to those who celebrate! Did you get the bits already? Go, go, go! Java 22 is a _significant_ improvement that I think is a worthy upgrade for everyone. There are some big, final released features, like Project Panama, and a slew of even-better preview features. I couldn't hope to cover them all, but I did want to touch on a few of my favorites.
6
+
7
+
I love Java 22, and of course, I love GraalVM, and both have releases today! Java is of course our favorite runtime and language, and GraalVM is a high-performance JDK distribution that supports additional languages and allows ahead-of-time (AOT) compilation (they're called GraalVM native images). GraalVM includes all the niceties of the new Java 22 release, with some extra utilities, so I always recommend just downloading that one. I'm interested, specifically, in the GraalVM native image capability. The resulting binaries start almost instantly and take considerably less RAM compared to their JRE cousins. GraalVM isn't new, but it's worth remembering that Spring Boot has a great engine to support turning your Spring Boot applications into GraalVM native images.
6
8
7
9
8
10
@@ -453,6 +455,20 @@ These features are in preview in Java 22. I don't know that they're worth showin
453
455
454
456
Virtual threads give you the amazing scale of something like `async`/`await` in Python, Rust, C#, TypeScript, JavaScript, or `suspend` in Kotlin, but without the inherent verbosity of code and busy work required to use those language features. It's one of the few times where, save for maybe Go's implementation, Java is just straight-up better in the result. Go's implementation is ideal, but only because they had this baked in to the 1.0 version. Indeed, Java's implementation is more remarkable precisely because it coexists with the older platform threads model.
455
457
458
+
## Implicitly Declared Classes and Instance Main Methods
459
+
460
+
This preview feature is huge quality-of-life win, even though the resulting code is smaller, and I warmly welcome it.
461
+
Unfortunately doesn't really work with Spring Boot, at the moment. The basic idea is that one day you'll be able to just
462
+
have a top-level main method, without all the ceremony inherent in Java today. Wouldn't this be nice as the entry point
463
+
to your application? No `class` definition, no `public static void`, no unneeded `String[]` args.
464
+
465
+
```java
466
+
void main() {
467
+
System.out.println("Hello, world!");
468
+
}
469
+
470
+
```
471
+
456
472
## Statements Before Super
457
473
458
474
This is a nice quality of life feature. Basically, Java doesn't let you access `this` before invoking the super
@@ -617,6 +633,105 @@ The example above demonstrates that gatherers are also composable. We actually h
617
633
618
634
Still don't quite understand? I get the feeling that's going to be okay. This is a bit in the weeds for most folks, I'd imagine. Most of us don't need to write our own Gatherers. But you _can_. My friend [Gunnar Morling](https://www.morling.dev/blog/zipping-gatherer/) did just that the other day, in fact. The genius of the Gatherers approach is that now the community can scratch its own itch. I wonder what this implies for awesome projects like Eclipse Collections or Apache Commons Collections or Guava? Will they ship Gatherers? What other projects might? I'd love to see a lot of common sense gatherers, eh, well, _gathered_ into one place.
619
635
636
+
## Class Parsing API
637
+
638
+
Yet another really nice preview feature, this new addition to the JDK is really tuned to framework and infrastructure
639
+
folks. It answers questions like how do I build up a `.class` file, and how do I read a `.class` file? Right now the
640
+
market is saturated with good, albeit incompatible and alway, by definition, ever so slightly out of date options like
641
+
ASM (the 800 lb. gorilla in the space), ByteBuddy, CGLIB, etc. The JDK itself has three such solutions in its own
642
+
codebase! These sorts of libraries are everywhere, and critical for developers who are building frameworks like Spring
643
+
that generate classes at runtime to support your business logical. Think of this as a sort of reflection API, but
644
+
for `.class` files - the literal bytecode on the disk. Not an object loaded into the JVM.
645
+
646
+
Here's a trivial example that loads a `.class` file into a `byte[]` array and then introspects it.
0 commit comments