Oracle's legal battle to break itself off a chunk of the smartphone market by attacking Android looks dead in the water today, after a federal judge who recently finished presiding over the six-week Oracle v. Google trial ruled that the structure of the Java APIs that Oracle was trying to assert can't be copyrighted at all.

It's only the code itself—not the "how-to" instructions represented by APIs—that can be the subject of a copyright claim, ruled Judge William Alsup. "So long as the specific code used to implement a method is different, anyone is free under the Copyright Act to write his or her own code to carry out exactly the same function or specification of any methods used in the Java API," wrote the judge.

Google had copied certain elements—names, declaration and header lines—of the Java APIs. Alsup ruled that even though Google could have rearranged "the various methods under different groupings among the various classes and packages," the overall name tree is "a utilitarian and functional set of symbols, each to carry out a pre-assigned function... Duplication of the command structure is necessary for interoperability."

The ruling is the cornerstone of what now looks like a complete win for Google in its legal struggle with Oracle, which began more than two years ago. The order follows an inconclusive copyright trial and a patent trial that Oracle also lost.

Library as a metaphor

Alsup compared APIs to a library, with each package as a bookshelf in the library, each class a book on the shelf, and each method a chapter out of a how-to book. "As to the 37 packages, the Java and Android libraries are organized in the same basic way but all of the chapters in Android have been written with implementations different from Java but solving the same problems and providing the same functions." The declarations, or headers, "must be identical to carry out the given function," wrote Alsup.

Ninety-seven percent of the source code in the API packages is different; it's only the three percent that overlaps that formed the heart of Oracle's copyright claim. That three percent included packages, methods, and class names. But those declarations—like starting a function with package java.lang —can only be used in certain ways. "In order to declare a particular functionality, the language demands that the method declaration take a particular form," notes Alsup (emphasis in original).

Alsup's ruling comes less than a month after a European court made a decision along the same lines, finding that programming APIs can't be copyrighted because it would "monopolize ideas."

What now?

Overall, Oracle spent many millions—perhaps tens of millions—on its legal crusade against Google and came up empty. The company scanned 15 million lines of Android code and found one simple nine-line function that had been copied from Java; that code is no longer in Android, and Oracle will be limited to statutory damages for that copying, which can't be more than $150,000 (and could be much less).

Oracle has promised to appeal the decision, saying it will continue to support "the broader Java community" of over 9 million developers. "The court's reliance on "interoperability" ignores the undisputed fact that Google deliberately eliminated interoperability between Android and all other Java platforms," the company said in a statement issued this afternoon. "Google's implementation intentionally fragmented Java and broke the "write once, run anywhere" promise."

To get any copyright royalties from Google, Oracle will not only have to get Alsup's API decision overturned on appeal, it would have to win a whole new jury trial as well. That will take years and looks exceedingly unlikely at this point.

For the Java programmers of the world, things won't really change much. If Oracle had won, it would have been a novel case of a company being able to essentially reverse the open-source process by making any commercial use of Java a pay-to-play endeavor. Some speculated an Oracle win could have scared programmers away from Java, but that kind of ruminating is a moot point now.

It didn't take more than 15 minutes from the time Alsup's ruling showed up on the federal court's e-filing system for a Google spokesperson to send out a statement on the company's win: "The court’s decision upholds the principle that open and interoperable computer languages form an essential basis for software development. It’s a good day for collaboration and innovation."

A case management conference is scheduled for June 21 in Alsup's court. That conference will deal with the small amount of statutory damages Oracle is owed.

Even on the one admittedly copied function, Alsup clearly thinks Oracle is way out of line. He devoted a whole section in today's order to the copied function, called rangeCheck(), calling the copying did take place "innocuous and overblown by Oracle." Joshua Bloch, the Google engineer who wrote rangeCheck(), wrote it in his own spare time, as part of a larger block of code which he donated to an open implementation of Java. "This was an innocent and inconsequential instance of copying in the context of a massive number of lines of code," Alsup concluded.