Project Jigsaw . Emerging languages . Android N . Spring 4.3 is in the air and 2016 is already shaping into a productive year for Java developers. Over the last few months, we’ve seen rapid progress on Java 9, and early signs of Java 8 support on Android devices. In this issue of the Java Annotated, we’ll explore future updates to the Java platform, new JVM languages, and open source releases from around the Java community.
Jigsaw Arrives in JDK 9 – Project Jigsaw, an effort to modularize the Java platform, is now coming soon to a JDK near you . Promising vastly improved options for dependency resolution , Jigsaw brings a number of critical and long-awaited updates to package management in Java. Together, these changes will yield an array of benefits including a modularized JDK , and added support for creating user-defined modules .
JEP 283: Enable GTK 3 on Linux – Support for GTK 3 may signal a change in the status quo of Java graphics on Linux desktop environments. OpenJDK’s longstanding disregard for Linux GUIs have spurred numerous forks and patches , putting strain on cross-platform development. Together with other proposals targeting Linux, JEP 283 would help to ensure long-term support for AWT/Swing on modern Linux distros.
JEP 286: Local-Variable Type Inference – Typically last in line to adopt new language features, Java may now join its forward-thinking contemporaries in providing type inference, present in other JVM languages and to a limited degree in generics , since Java 5. Though fairly conservative, this proposal would expand support to include local variables. But as Stephan Rauh demonstrates , not all news is good news.
Kotlin 1.0 Released – Kotlin’s inaugural release contains a highly distilled set of best practices and syntax improvements for Java developers. Featuring strong type safety and first-class tooling support, developers can learn the language in a few days and get started building Android apps with Kotlin and Anko . Or Spring Boot applications with Kotlin . Or even writing their own DSLs . Kotlin is designed and built at JetBrains.
Frege 3.42 Alpha Released – One of the few purely functional languages on the JVM, Frege is a Haskell-like language that compiles to Java, offering unrivaled brevity and Java’s vast collection of libraries and frameworks. If you appreciate Java’s type system and functional capabilities then you’ll enjoy Frege’s global type inference and functional purity. Frege is developed by Ingo Wechsung and Dierk König .
Ceylon 1.2.2 now available – Built by some very talented developers and community members at Red Hat, Ceylon 1.2.2 brings a number of new features, improvements, and bug fixes. Offering a powerful set of language features including union types and reified generics , Ceylon seeks to add a number of features traditionally found lacking in Java, with interesting comparisons to Kotlin . Give Ceylon a try and share your thoughts!
Android N – Android’s latest arrival is unceremoniously released for developer preview, just under a year after its predecessor last May. Most notably, this release supports Java 8 language features , a highly anticipated update in the Android community. Among other things, Android also introduces multi-window support . If tools are your cup of tea, jump in and preview Android Studio 2.1 Preview for Android N Preview .
Jack – First introduced in in 2014, the Jack and Jill compiler toolchain has now made its official debut with Android N. An open source compiler kit for the Android toolchain, Jack delegates the complexity of building an app, from shrinking, obfuscation, repackaging and multidexing, to a single tool, configurable from your applications build.gradle file. Stay tuned for updates on using other JVM languages with the Jack compiler.
Android Performance Patterns – Season 5 of Android Performance Patterns has a slew of tips and tricks for optimizing threading on Android devices. You’ll learn the basics of Android threading , proper care and feeding of AsyncTask , how to use ThreadPools , IntentService , and other threading primitives , and the importance of thread priority and good memory management – as always, from your cheerful host Colt McAnlis .
JavaCPP – In theory, C++ and Java should work smoothly together. They share many language and syntax features, are both object oriented, and offer strong type safety guarantees. But anyone using Java’s Native Interface knows the bridge runs over troubled water . Built by Samuel Audet , JavaCPP is aimed at Java users looking for a more friendly route. Short of building the Panama canal , this is about as good as it gets .
Retrofit 2.0 released – Retrofit is a type-safe HTTP client for Android and Java that makes it easy to wrap HTTP APIs with Java interfaces, and call those endpoints just as you would a local Java method. Built and maintained by Jake Wharton at Square, Retrofit 2.0 brings a number of API changes and backend changes, facilitating greater extensibility and support for pluggable converters. See this talk for more information.
Flyway 4.0 Released – Showing enormous growth in 2015, Flyway is now the foremost database migration tool for Java. Offering automated, versioned database migration support for almost all major databases , Flyway lets you run plain-old SQL and Java-based migrations with little extra configuration. Flyway 4.0 works with Java, Android, and Spring applications, and now ships with a number of new features and bug fixes .
Comparing Rust and Java – Rust offers many benefits of C++ and Java, combining low-level control and high-level convenience and type safety . In this article, Andrey Bogus evaluates Rust coming from a Java developer’s perspective. Nearly one year old, Rust has garnered a strong community , and also some familiar developer tools . For weekly updates from the Rust community, subscribe to This Week in Rust .
Introduction to Web Scraping with Java – Scraping the web is a time-honored programming tradition, a disarmingly mundane task that offers lessons in software engineering and humility. Kevin Sahin , software developer at Boursorama, illustrates building a web scraper, from working with HTML, to handling authentication , to downloading files . May we also suggest the handy jBroswerDriver for your daily web-scraping needs?
Playing with Spark – Spark is a small web framework inspired Sinatra for Ruby. André Barbosa , platform engineer at Unii gives us a firsthand look at building a lightweight web application with Java 8 and Spark. With lambdas and a number of utility methods , serving data with Spark becomes even more terse , giving you the ability to write a small web app or microservice (such as a URL shortener ) in a few lines of code.