News

Java Annotated Monthly – June 2016

Java: past, present and future – we’re still counting down to the release of Java 9, there are ever more resources for getting a handle on what Java 8 can offer us, and the Oracle vs Google court case is over (for now). The language is not the only thing that continues to evolve, well-used libraries like JUnit and Log4J are making the most of modern Java. But with all this change, we need to keep an eye on performance and correctness.

JavaAnnotatedMonthly@2x

Java 9

Early Access build 121 is now available for JDK 9 and JDK 9 with Jigsaw.  Check the documentation for using the early access builds. There’s also a matrix of open source projects that have been tested against JDK 9. And don’t forget, if you do run into any unexpected behaviour, you can ask for help.

Although Jigsaw is the most talked about feature in Java 9, it’s nice to see it’s not the only thing we’re waiting for, there are several other interesting features.

Garbage collection is changing in Java 9, to get a heads-up on the new options, take a look at the new garbage collectors in OpenJDK.

Java 8

Everyone may be getting excited about Java 9, but with Java 8 maturing and seeing good adoption, there are plenty of resources out there for getting up to speed on new features like Optional, reading pragmatic advice from those who’ve been using these features, or leveling up your Java 8 knowledge. For example, it’s worth getting to know CompletableFuture and looking at some examples to understand what you can achieve with asynchronous programming.

Even accepted standards that we’ve coded to for years can be dusted off and questioned.

Continuing Evolution

The eagerly awaited JUnit 5 is available in alpha. Take a first look at how this could change our unit tests.

Log4j 2.6 is out, with a number of configuration options to let it run in a garbage free fashion. This, combined with its support for Java 8 lambdas, can help reduce your logging framework’s impact on performance.

Twitter released a Pants build tool. I’m fairly certain that it’s not actually pants though, it’s probably rather good.

Performance and Correctness

Java 8 came with performance improvements for HashMap. To understanding why this is, have a look at how HashMaps work in Java 7 and 8.

One of the main culprits for adding unnecessary processing to our applications is the way we create Strings. Benchmarking shows how the approach we take impacts performance.

And remember, getting the best performance out of your application depends upon what “best performance” means for you.

Good testing practices, such as TDD, aren’t just applicable to plain vanilla Java. Find out more about testing Java EE (and did you know how Java EE standards are tested?), and what are some of the challenges when testing in Android.

More Politics

We finally have a ruling in the Oracle vs Google case, with the court stating that Google’s use of the Java APIs  in Android is “fair use”, which many see as a Good Thing and a victory for developers. Of course, we can’t just get on with our lives safe in the knowledge of a resolution, as Oracle is likely to appeal again, nor should we simply ignore the fuss, as the case is likely to have an impact on software development regardless of who ultimately wins.

And finally…

In case you missed the IntelliJ IDEA news in this blog, remember the 2016.2 EAP is now open and keep an eye out for our Refactoring with IntelliJ IDEA webinar.

Thanks for reading!

image description