Java Annotated Monthly – February 2016

The Java ecosystem is teeming with new technologies. Whether you write mobile apps or middleware, dozens of new libraries and frameworks are released each month. Today’s Java ecosystem is not just growing – but growing up. With the introduction of lambdas and streams, we have seen enormous growth in functional programming and reactive patterns in modern Java. But how on earth is a busy developer to stay ahead of the latest techniques in state-of-the-art Java? As a reader on the Java Annotated, you’re already well on your way. Join us each month, as we explore the latest developments and evolving trends around the Java community.



Programming with Modularity and Project Jigsaw – Over the last five years, and more recently in the past two, Java has been undergoing a large-scale renovation to address the growing technical debt from years of legacy APIs and tangled dependencies. Initially aimed at JVM developers building a more modular JDK, Project Jigsaw’s original requirements gradually evolved to support Java applications and libraries, paving the way for more precise dependency resolution, stronger encapsulation semantics, and giving developers more flexibility to deploy applications in lightweight, containerized environments. Nicolai Parlog will demonstrate how to build applications with modules in Java 9.

JDK 9 to deprecate Java browser plugins – Early Java adopters may remember a tag called <applet> (alongside <bgsound> and <blink> for extra style points). Sadly, plans to sunset this technology in Java 9 will bring an end to any future designs you might entertain. For the nostalgic, may we recommend The Rise and Fall of the Java Applet, a short history of Java’s notoriously insecure and now largely obsolete web browser technology. Perhaps more importantly, there are ways to migrate from applets to plugin-free Java technologies, such as JavaWS.

Writing a Language in TruffleLast month, we covered the latest news from JRuby+Truffle. But what exactly is Truffle, and how can you use it to achieve blazingly fast performance for dynamic languages like Ruby and JavaScript? In this series, Cristian Esquivias demonstrates how you can write and optimize an interpreter for dynamic languages by using Truffle and the Graal VM. To learn more about Graal, the next generation just-in-time compiler for the JVM, Christian Wirth has an excellent presentation that covers all the important details.


Android Studio 2.0 – Android Studio quickly approaches its second release, bringing new and long-awaited features to the Android development community. Now sporting a brand new emulator and vastly improved hot-swap technology, Android Studio can build and deploy applications more quickly than ever before. In addition to a new GPU Profiler and hundreds of recent fixes from the Android Tools team, Android Studio 2.0 also brings over the latest enhancements in IntelliJ IDEA 15, offering a number of debugging and version control improvements.

Developing For Android, By Managers – While Java developers have historically brought a wealth of experience to the Android ecosystem, those who are familiar with server environments would be mistaken to assume that developing on Android is a similar experience. With this in mind, Android engineers at Google published a compendium of performance wisdom that developers from all walks can use to improve their understanding of the Android platform. In this talk, Romain Guy and Chet Hasse share a number of useful insights contained within.


The Influence of the Java Collection Framework on Overall Energy ConsumptionRui Pereira et al. present a comparative study on the energy consumption of several implementations of Sets, Lists, and Maps. Measurements are taken with jRAPL. The authors introduce a novel method for minimizing total energy consumption by dynamically swapping in collections at compile time based on the most efficient implementation for a given task. Compare these results with Energy profiles for Java Collections Classes. Source code is available on GitHub.

Investigating Novice Programming Mistakes in Large-Scale Student Data – A teacher once said the reason programming is difficult to teach, is that by the time we are ready to teach it, we’ve forgotten what it’s like to learn. Now, thanks to data collected from students learning Java, we have real statistics reminding us just how far we’ve come, and how little we know about programming. It turns out some of the most common errors encountered are also some of the easiest to detect (with the right tools). Ph.D. Candidate Michael Beyeler interprets.

Java for Small Teams – As software developers, we’d like to think the more code we write – the better we get. But sometimes it helps to step back and look at the fundamentals. Henry Coles, Java architect at NCR Edinburgh and author of the acclaimed mutation testing system, pitest, publishes a collection of best practices and common sense advice for writing Java on a small team. While sometimes highly opinionated, taken together, these recommendations will ultimately help you write cleaner code, with fewer bugs and errors down the road.

Arrays of Wisdom of the AncientsAleksey Shipilёv compares the performance of Collection.toArray(new Foo[0]) and Collection.toArray(new Foo[size]), concluding the former is universally faster on modern JVMs. Although most of us might prefer a nullary Collection.toArray(), due to Java’s type erasure semantics this is unlikely to happen until much later, if at all. Conventional wisdom may be due for an update, but the result is only half the story – for valuable insight into the tools and process behind this result, check out this and other articles from the creator of JMH.

image description