As you may have read, reported with varying cadences of hysteria, Java 9 stands to bring a series of changes to the platform. These potentially breaking changes will focus around Java tooling and internal APIs, and whilst there is largely no need for alarm, it’s a good idea to get to know and prepare for the adjustments you’ll be needing to make before it officially goes GA.
Notably this month, the proposed excision of .Unasafe in particular has aroused a good deal of angst from some quarters, with Prashant Deva labelling Oracle’s plan to either remove or at least hide by default sun.misc.Unsafe “an absolute disaster in the making” and, something that could potentially “completely destroy the entire ecosystem around Java.”
Deva’s claims are grounded in the basis that a high number of key Java tools, infrastructure software and high performance libraries are – in spite of the warnings – layered over Unsafe. It might be a little premature to sound the OMG DOOM klaxon at this stage however. For one, Java’s architects are more than aware of the reliance on .Unsafe in the ecosystem, whether they approve or not, and are not going to simply yank the rug out from under these projects.
Whilst there’s a good chance that Java will live to see many more updates post .Unafe removal, this panic does emphasize the need for developers to tinker with upcoming features and road test ahead of general release. Moreover, the whole point of these advance warnings is to ensure that devs have plenty of time to plan and navigate around shifts in the platform terrain.
In this spirit of forward planning, Oracle have just released a sneak peek of JShell and Read-Eval-Print Loop (REPL) coming in Java 9. With REPL, tipped by Java Language Architect Brian Goetz the real “sleeper” feature of the next big release, you can evaluate code snippets such as declarations, statements, expressions. Developers can test your code as they write it rather than waiting until the end of the project.
According to Oracle, schools are adopting languages that have REPL functionality “because it lowers the initial learning curve of programming. The interactive REPL tool gives rapid evaluation of code to young developers.” They’ve also put together a short video where Jim Connors gives a short demo of how you can now experiment with the tool as part of the latest Java 9 build. Check it out below: