3 Features in Java 9 that WILL Change How You Develop Software
In this post we’ve gathered some of the features we believe are the most exciting ones that are targeting Java 9 – Apart from the usual suspect, project Jigsaw, which took on the mission of breaking down the JRE and bringing modularity to Java’s core components.
Here some of the features which are an absolute must to know about in Java 9, some of these are already ready for you to tinker with in the early release version.
Yes. Previously we had doubts that project Kulla would make it in time for Java 9 but now it’s official. The next release of Java will feature a new command line tool called jshell that will add native support and popularize a Java way to REPL (Read-Eval-Print-Loop). Meaning, say, if you’ll want to run a few lines of Java on their own you won’t have to wrap it all in a separate project or method.
There are some alternatives like REPL add-ons to popular IDEs and solutions like the Java REPL web console, but no official and right way to do this so far. jshell is already available in the early release and waiting for you to give it a test run.
2. Noteworthy API Updates: Concurrency and Stack Walking
Flow is the Java implementation of the Reactive Streams API, and we’re pretty excited that it’s coming to Java. Reactive Streams solve the pain of back-pressure. The build-up of data that happens when the incoming tasks rate is higher than the application’s ability to process them, which result in a buffer of unhanded data. As part of the concurrency updates, Comparable Future will also get an update the will resolve complaints that came in after their introduction in Java 8. This will include support for delays and timeouts, better support for subclassing, and a few utility methods.
The second thing we wanted to mention here is the Stack Walking API. That’s right, Java 9 will change the way you traverse stack traces. This is basically an official Java way to process stack traces, rather than simply treating them as plain text. It also kind of sounds like a vague Star Wars reference. Which made us like it even more!
3. G1 will be the new default garbage collector
A common misconception we often hear is that Java has only one garbage collector when in fact it has 4. Prior to Java 9, the default garbage collector was the Parallel / Throughput Collector, and now it will be replaced with G1 which was introduced in Java 7.
Generally, G1 was designed to better support heaps larger than 4GB and has been known to cause less frequent GC pauses, but when a pause do comes, it tends to be longer.