Android N is Saying Goodbye to Oracle’s Proprietary Java APIs

Google has announced to move away from Orcale’s proprietary Java Application Programming Interfaces (APIs). In the next version of their operating system, Android N, the new standard will be OpenJDK, an open source alternative.

It all started last month with a “mysterious Android codebase commit”  which shows 8,902 files were changed, clearly notes OpenJDK code was added to Android:

Initial import of OpenJdk files.
Create new libcore/ojluni directory with src/main/java and src/main/native subdirectiories.
Build ojluni into core-oj jar.
Use openjdk classes from java.awt.font package.
Copy all files from jdk/src/share/classes and jdk/src/solaris/classes directories in openjdk into libcore/ojluni/src/main/java.
Copy following native files from openjdk to libcore/ojluni/src/main/native: [long list of files]

I largely suspect it has a lot to do with Oracle vs Google case in which Oracle, which only bought Java a few months ago from Sun Microsystems, claimed Android has copied Java’s source code in their operating system. To anyone who didn’t follow the case, the main code in question was just a few lines written by a guy at Google who previously used to work at Sun on Java. That’s right. He wrote the code in both cases (among thousands of lines of code he wrote on both projects) and it happened to be the same on a few lines by the same guy (Joshua Bloch). Out of millions of lines, this was it:

private static void rangeCheck(int arrayLen, int fromIndex, int toIndex) { 
    if (fromIndex > toIndex) 
        throw new IllegalArgumentException("fromIndex(" + 
             fromIndex + ") > toIndex(" + toIndex+")"); 
    if (fromIndex < 0) 
        throw new ArrayIndexOutOfBoundsException(fromIndex); 
    if (toIndex > arrayLen) 
        throw new ArrayIndexOutOfBoundsException(toIndex); 

Continue reading