Google is switching from the implementation of Java in Android, based on Apache Harmony, to a new one based on Oracle’s OpenJDK.
The reason for the replacement is a matter of debate among developers and industry observers, but most agree that there are technical benefits to the change. Still, many folks point to the Oracle vs. Google lawsuit, and say Google is making concessions to settle the lawsuit and head off possible future claims. Whatever the reason, Android N, the codename for the next major version of Android, will be based on OpenJDK.
Apache Harmony is an open-source, “clean room” implementation of Java developed by the Apache Software Foundation. OpenJDK is Oracle’s free and open-source implementation of Java, licensed under the GNU General Public License (GNU GPL) with a linking exception.
Oracle closed its acquisition of Sun Microsystems in January 2010 and in August of that same year, it sued Google for copyright and patent infringement over Google’s use of Java in Android. At issue was the improper use of Java APIs, Oracle claimed. However, Google argued that APIs could not be copyrighted and eventually won its case in a 2012 jury verdict. Yet, in 2014 another court partially reversed the prior ruling to side with Oracle. The case is ongoing and the legal battle rages on — as does the fight over developer mindshare.
According to Andreas Gal, an entrepreneur and former CTO of Mozilla who has strong views of Google’s move, Harmony is no match for OpenJDK. “There is basically no technical advantage in using Harmony,” he said in a blog post. “It’s a strictly less complete and less correct version of Sun’s original implementation. Why did Android invest all this effort to duplicate Sun’s open source Java standard classes?”
Gal argues that Google move to support Harmony was all about licensing. “Over the course of Android’s meteoric rise, the powers behind Android demonstrated a deep strategic understanding of different classes of open source licenses, their strength, and their weaknesses,” he said. “Android has from its early days successfully used open source licenses to enable proprietary technology. Sounds counter-intuitive, but it explains why Google rewrote so much open technology for Android.”
Yet, Bradley Kuhn, president of the Software Freedom Conservancy sees things a bit differently. “I speculate that Google weighed a technical decision against its own copyleft compliance processes, and determined that Google would succeed in its compliance efforts on Android, and thus won’t face compliance problems, and can therefore easily benefit technically from the better code,” Kuhn said in a blog post.
Now the decision to move to OpenJDK will benefit developers because it brings with it support for Java 8 and all of its new language improvements and features such as lambdas. Lambdas support programming in a multicore environment by adding closures and related features to the Java language.
Indeed, Java 8 brought with it enhanced developer productivity and significant application performance increases through reduced boilerplate code, improved collections and annotations, simpler parallel programming models and more efficient use of modern, multicore processors. Thus, the move to OpenJDK brings Java 8 support and also simplifies the Android code by providing a common code base for development.
However, in the short term, Google’s biggest challenge will be to rip out Harmony and replace it with OpenJDK, Gal said. It appears Google began the effort last February. “All this code and technology churn will have massive implications for Android at a tactical level,” Gal said. “Literally millions of lines of code are changing, and the new OpenJDK implementation will often have subtly different correctness or performance behavior than the Harmony code Google used previously.”
Gal said he foresees delays in Google getting Android N out on time. Moreover, Gal said he believes Oracle is the clear winner in this Google gambit.
“No matter how you look at this, this is a huge victory for Oracle,” Gal said. “Oracle never had much of a mobile game, and all of a sudden Oracle gained a good amount of roadmap and technology influence over the most important mobile ecosystem by scale. Oracle is a mobile titan now.”