This week IBM announced it would be supporting Oracle's OpenJDK. At first glance it seems like "Great!"
Isn't it good that two big supporters of Java are getting behind a single open source project?
Well, in my personal opinion, no. It is bad. Bad for Java. I'll try to explain why.
The first point is that IBM are not just saying they will support OpenJDK. They are also saying that are pulling effort out of Apache Harmony. Apache Harmony is a project to build an Open Source JVM under the Apache license, rather than the GPL which is the license under which OpenJDK is available.
Harmony significantly predates OpenJDK and parts of Harmony are widely distributed in Android phones. Unfortunately there is a huge cloud over Harmony right now, and this news just made that cloud a good deal blacker. The lack of some IBM committers on the project isn't the problem. Apache encourages enough diversity that projects live on when one company pulls out.
To understand the clouds over Harmony let's first look at the legal situation here. Intellectual property, as we all know, is protected by two main models: copyright and patents. Simplifying hugely, copyright is about copying code, patents about copying ideas.
Apache Harmony was designed and built as a clean room implementation of Java. So no code was copied from any existing copyrighted JVM. But that doesn't protect against copying ideas - because even if the developers came up with the same idea independently, the patent still applies.
So how do Open Source projects protect themselves against patent issues?
The main way is to work with Open Standards that are covered by Open Specification promises or "Royalty Free" patent licenses. This is where major IP owners such as IBM and Microsoft have stated that they will not exert patent rights over either Open Source or Open Standard implementations of a particular standard.
Likewise most new standards from organizations such as OASIS are built on a Royalty Free basis, which means that all the companies that helped author the standard offer a free patent license to anyone implementing the standard.
There is a model under which Sun (and now Oracle) offers protection from patent issues: The Java Specification patent grant says that as long as you fully implement the Java specification and pass the tests that prove it - the Technology Compatibility Kit (TCK) - then you have a perpetual royalty-free license to patent rights that Oracle has over Java.
This sounds great. Not only has Sun/Oracle has made available Java under an Open Source license (GPL), but if you don't want to use GPL you can simply write another JVM that conforms to the tests and you won't be sued for patent infringement. Perfect. So what on earth are those whiners at Apache bothered about?
Unfortunately it isn't quite so simple. I hope you are following me so far. All Apache Harmony needs to do to protect against patent suits is to pass the TCK. Can Apache Harmony pass the TCK? Well, yes and no. Would it pass the TCK if the tests were run? Probably. Can the tests be run? No.
The TCK is not available to Apache in a way that allows Apache to run it. The JDK is available as Open Source, but the TCK isn't. To protect against patent issues, you have to talk to Oracle and get the TCK. And they will only give it to Apache with restrictions. In particular restrictions of a kind called Field of Use (FOU) restrictions.
Ok, this is becoming overly legal. I apologise. But I think its important to understand this story, because this really gets to the heart of how open Java is.
Open Source is not just "published code". If you take an Open Source library, then you are allowed to redistribute the code without prejudice. This is key to Apache and the Apache license. So Apache can't build in restrictions on who is allowed to take Apache code or what they can do with it. The Apache license doesn't allow it.
Unfortunately, Sun - and now Oracle - have said that they will only give the TCK to Apache if it restricts how the Harmony code can be used. Effectively what Sun/Oracle is trying to say is that Harmony code cannot be used by mobile devices (like Android). If Apache were to go along with this, it would mean shipping Apache Harmony under a different license from the Apache License. And this would no longer be Open Source.
Why not? Well a key part of the definition of Open Source is that there is no restriction on the Fields of Endeavour. In other words, if Apache agrees to the FOU restrictions that Oracle insists on, then the result would be that Harmony would not be Open Source. Naturally Apache cannot agree to that.
Let's recap. Anyone can create an Open Source JVM, but they cannot get patent protection unless they agree to Oracle's FOU restrictions, at which point it is no longer Open Source. Therefore no-one but Oracle can create an Open Source JVM without fear of being sued.
Ok, this all sounds highly legalistic and possibly quite theoretical so far. That was until Oracle sued Google over patents breached by Android phones running code from Harmony. The gloves are off. And the real result of this is that the only Open Source JDK that you can rely on having a patent grant is the OpenJDK. And if I modify OpenJDK then I am at the mercy of Oracle to grant me a TCK license.
Unfortunately this is simply bad for Java. Java as a language is threatened by many other new and old languages. For many users its simply a commodity runtime that they will use as long as it is commonly available. And knowing there are Open Source implementations that they can use is part of that decision. Knowing that there is effectively only one Open Source project that is free from Oracle's patent claims will affect the perception and the reality of Java's openness. And for many people the fact that this is under the GPL is an issue. You can see why IBM joined OpenJDK: Oracle has Apache Harmony in a tight place.
If you want to know more - as well as hearing the official Apache line as well as my own, then please take a look at Apache's letter to Sun when this first happened.
When this first blew up Sun was a struggling company that you could have argued needed the extra revenue Java licensing to mobile phones bought them, and which Harmony and Android threatened.
The question before us now is whether the same is true of Oracle, and whether Oracle is working in the best interests of its customers, the Java community, and the Open Source community. Do you believe that Oracle should license the TCK under an open license? And are you happy that despite the move to take Java Open Source, there really is no freedom to create Open Source implementations of the Java language.
The good news for Harmony is that Apache's diversity approach means that IBM pulling out won't harm the future of the code. The bad news is that there is one less company putting pressure on Oracle to make Java truly open.
Paul Fremantle is CTO of WSO2, where he works on Open Source projects in Apache, including the Apache Synapse and Incubator projects. He has contributed to Apache since the first Apache SOAP project. While at IBM, he was instrumental in starting up the Apache WSIF and Apache Woden projects, as well as being heavily involved in the AxisC/C++ initiative, where he led IBM's involvement. Publications include co-authoring "Building Web Services in Java, 2nd Edition", articles on Web Services and SOA, and a redbook - "The XML Files: Using XML and XSL in WebSphere".
Paul will at ApacheCon 1-5 November 2010.