There is little to cheer about when the stewards of two of the most important application platforms in the industry, Oracle of Java and Google of Android, decide to fight it out in the courts. Oracle's lawsuit threatens both platforms: the publicity and "bad guy" image hurts Java, and the legal uncertainty hurts Android. It seems a lose-lose situation, doesn't it? Nevertheless, I still hope for a positive outcome for the Java world.
It's not Java as we know it
One thing to keep in mind is that neither technologies involved are "Java" as we normally understand it. On the Sun/Oracle (Snorcle?) side, we are not talking about Java SE, but their Java ME (J2ME) mobile platform. Java ME never got the language features of Java 5 (generics, annotations, new for loop etc), and the system class library is a pitiful subset of Java SE. Java ME implementations normally come with an alphabet soup of variable or optional APIs (CLDC, MIDP, JSRxxx). While Java is open source, the GPL license is impractical for commercial use, so phone companies generally have to license Java ME. Commercial versions of Java ME contain close source, proprietary code.
On the Android side, Google does not pretend it has a Java platform.The Dalvik virtual machine does not run Java bytecode. Its class libraries match neither Java SE's nor Java ME's. Android evolves completely independently of the Java standardization process (JCP). In other words, you have the Java programming language without the Java platform. Of course, these differences arguably resulted in a superior overall platform, but the fact remains that Android does not have a real Java platform implementation.
What we have here are two distinct and incompatible platforms: an open standard, sorta-closed source platform (Java ME) competing against a vendor-controlled, open source platform (Android).
It's not the first Java lawsuit
The other prevailing narrative that I don't really accept is that Oracle decided on an unprecedented litigatious approach to Java, contrary to Sun. In fact, we've seen this happen before with Microsoft's Java extensions. The substance and legal merits of the two lawsuits are completely different, of course, but there is a similarity from a developer's perspective. Then as is now, a vendor-controlled implementation became incompatible with standard Java. Sun sued that vendor (Microsoft) to prevent incompatible fragmentation of the Java platform, one that is clearly happening again right now.
Then again, Java ME has its own fragmentation problems. But at least this fragmentation is theoretically solvable with a API superset approach, such as with the MSA initiatives. Google's extensions, by contrast, incompatibly duplicates much Java ME functionality. No subset of Java will result in a binary that can run on both Java ME and Android's bytecode-incompatible Dalvik runtime, eliminating Java's write-once-run-anywhere promise. Might it remotely be possible that an outcome of this lawsuit, like the previous one against Microsoft, is to unify the Java platform?
My wishful thinking
My hope comes from the fact that both combatants in this lawsuit are publicly traded, economically rational entities. Long ago, Lotus sued Borland over their respective spreadsheet products. While the lawsuit sucked away time, money and the attention of their top leadership, Microsoft cheerfully captured the spreadsheet market from the bloodied combatants. Similarly, this lawsuit could be disastrous for both Oracle and Google. I am counting on rational minds to recognize this danger and negotiate a good outcome. What would a good outcome look like?
What I am hoping for is that Google agrees to license Java ME compatibility for Android. I'm hoping that Google will provide a substantial implementation that includes all the modern options (support for OpenGL, touchscreen, GPS, media etc). With Android likely to be the dominant smartphone platform, this Java ME implementation will also be the de facto Java ME baseline.
What would Java gain from this? Android will help define a baseline Java ME platform, reducing fragmentation. Java ME apps would be able to run on most smartphone platforms: Android, BlackBerry, Symbian and Windows Mobile.
What would Google gain from this? Java compatibility means Android would have another class of apps -- in addition to Flash -- it can run that the iPhone can't. A Java ME app is unlikely to work as well as a native Android app, but in cases where app portability is critical it may simply be good enough.
Even with Google's support, Java ME needs to resolve a number of problems before it can be successful. But without Google's support, Java's write-once-run-anywhere promise will never be fulfilled for smartphones.