Is it legal for me to re-implement a Java library in another programming language under the GNU General Public License (GPL) version 2 (text)?

  • I would mimic their exact API (package, class, and method names) except replacing the trademarked word “java”.
  • The source code taken from the OpenJDK project for Java SE 8 would be used as a guide to write the equivalent as closely as possible line-by-line in the other language.
  • All of this would be made publicly available easily on a source-code sharing site such as BitBucket.com or GitHub.com. These files would include the necessary prominent notices and licenses statements as required by the GPL.

As an example, the source code from java.util.HashMap.

The Gnu.org FAQ, What does the GPL say about translating some code to a different programming language? says that translation to another programming language is treated like other modifications, acceptable if all terms of GPL are met.

I would have thought the GPL’s very purpose is to allow such freedom. My confusion stems from the Oracle versus Google appeal ruling of 2014-05-09 by the United States Court of Appeals for the Federal Court. That ruling upholds copyrightability of an API, which I can understand. What I do not understand is why that copyrightability issue is relevant given the source code is available under the GPL.

I suppose their are two core parts to my question:

  • Is the GPL rendered impotent if the original publishers decides to pursue a claim of copyright violation against anyone forking or imitating their GPL-licensed work? How can Oracle claim damages from infringing copyright on code published under the GPL?
  • Is there any other restriction beyond the terms of the GPL that would bar me from producing an open-source rewrite/translation of a Java (OpenJDK) library in another programming language?

1 Answer 1


The GPL that covers the OpenJDK certainly allows you to write and distribute your own Java implementation. On that point, your reading is absolutely correct. However, if that implementation is a derivative work of the OpenJDK, then the GPL requires you to make your derivative implementation available under the GPL as well, per the GPL's copyleft rules. If you follow the rules of the GPL, you can do exactly what you propose.

Note that the Supreme Court ruling in Oracle v. Google found that using only API structure and names, without copying any underlying implementation, constitutes fair use, and therefore doesn't require copyright permission. If you hold your implementation to that standard and use/look at only interfaces while authoring your new implementation, then your new work is broadly allowed under copyright law, so you do not need to rely on the GPL's permissions (and therefore neither do you need to follow its requirements).

Google didn't want to have to abide by the terms of the GPL, probably because due to concerns that the any GPL terms that applied to their Java implementation might also apply to other components of their system, which they wished to keep closed-source. In other words, if Google had claimed their acquired their right to use the APIs under the GPL, then they would have been required to put potentially the entire operating system under the GPL, which they had not done nor wished to do.

For this case, the GPL has been largely ignored because Google has not followed the requirements of GPL in licensing their Java implementation (and operating system that uses it), so there's no point in Google trying to claim that their right to use the API came from the GPL. Furthermore, Google claimed that they didn't use any of Oracle's copyrighted material, so it's not possible for them to say their use of Oracle's material was licensed under the GPL, as they claim there was no use whatsoever, licensed or otherwise.

This is explained at length on fosspatents.com's article "Q&A on the Dec. 4 Oracle v. Google Android-Java copyright hearing before the Federal Circuit":

2. Q: Does this litigation involve Google's rights to use certain Java code under an open source license?

A: No. Google could have incorporated Java into Android on open source terms, but chose to eschew the GNU General Public License (GPL) because of its "copyleft" feature.


If Google had ever claimed in this litigation that Android's incorporation of Java was authorized under the GPL, this would have been inconsistent with its claim that it didn't use any copyrightable material (you can only license something, on whatever terms, if it's protected) and, far more importantly, a blatant violation of Rule 11 (truthful pleading standard) resulting in sanctions for Google and its counsel. The GPL affords you four freedoms: it allows you to use software without paying for it (freedom 0), to modify its source code as you please (freedom 1), to redistribute copies (freedom 2), and to distribute your modified versions to others (freedom 3). But once you exercise freedom 3, you're subjected to the copyleft rule: you must make your modified version available under the GPL. As a result, Google would have had to publish Android under the GPL. But it did not. [...]

[...]Google seeks to exercise as much control over Android as possible. If Android had to be released under the GPL (and only under the GPL, or at least a compatible copyleft license), Google would have a hard time keeping a growing number of core Android components like its Mail and Map clients or even the new on-screen keyboard (again, more about that in the next section) closed -- and Google's hardware partners would have to release their proprietary enhancements such as Samsung's Touchwiz and HTC Sense under the GPL, which would run counter to their objective of differentiation because their competitors could then use the same code.

  • now that OpenJDK has been, to some degree, incorporated into ART, how does that effect, specifically, Touchwiz?
    – Thufir
    Jun 16, 2016 at 12:04
  • 1
    As a minor update, the US Supreme Court has ruled that Google's copying of the API constitutes "fair use." Explicitly mentioned in the ruling is the fact that Google did not at any point copy the implementation of those APIs.
    – A. R.
    Jun 3, 2021 at 18:44
  • @Andrew Thanks, it's been a while since I looked at this Q&A! I've just now made an attempted to fold that new precedent into the answer without having to overhaul it completely; hopefully I succeeded.
    – apsillers
    Jun 3, 2021 at 19:15

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .