This is a licensing question about the Dalvik and J2SE core libraries. In particular the license governing java.util.concurrent.SynchronousQueue.

The license header of the class in the JDK source states that it is GPLv2 only (see grepcode). However, the same file in the Dalvik core libraries seems to be governed by the Apache 2 license only (see android source).

How is this possible? I didn't think you could take GPLv2 source and re-license it as Apache 2.

(It's obvious they did: a comment above the Java Doc even says "removed link to collections framework docs"!)

I'm asking because I have a GPLv3 project and would like to include a derivative work of some source from the core libraries (either Dalvik or J2SE) but publish it under GPLv3. I thought I could do this with Apache 2, but not GPLv2.

I know that the J2SE class source is itself derivative work from public domain source, but the changes from the original are substantial. (The original is available at gee.cs.oswego.edu if you are interested.) Therefore the android source really is just a copy of the J2SE source, but published under Apache 2 instead of GPLv2. Is Google really allowed to do this?

  • Reimplementing the contract (interface) from scratch does not require using the same license. Just like subclassing does not require it either. The issue of ownership and licensing here is distinct from the issue of license compatibility in the context of linking.
    – user22815
    Apr 24, 2014 at 14:28
  • @JohnGaughan But the interface has been implemented identically! Inspecting the source it is obviously copied from the J2SE core library, and not from the original public domain work. Apr 24, 2014 at 15:33
  • that was not obvious from your question: if it is a verbatim copy except for the license, then it is either a license violation or the author received permission from the copyright owner to license it differently.
    – user22815
    Apr 24, 2014 at 15:38
  • 4
    Dalvik uses J2SE classes from the Apache Harmony project. Harmony was released (under Apache 2 license) prior to OpenJDK (which you are linking as the JDK source grepcode), so at that time the GPL license may not have been present in the SynchronousQueue code. Here is Harmony's version of SynchronousQueue
    – Nate
    Apr 24, 2014 at 17:12
  • @Nate I think your comment qualifies as the answer, but I can't mark it as such! Many thanks. I have looked at the Apache Harmony source and compared it the Android source: there are differences that bring it somewhat inline with the OpenJDK source, but I think it could still be considered derivative work of the Apache Harmony project. Apr 25, 2014 at 16:42

2 Answers 2


As a comment here has pointed out, Android's class library is derived from Apache Harmony's class library. Parts of it have been changed by the Android project, but remain Apache 2.0 licensed.

Google's policy regarding code that is part of the Android Open Source Project (AOSP) is that Apache 2.0 (ASL 2.0) is the preferred license. All the bits Google created that are in AOSP are Apache 2.0 licensed. The Linux Kernel, which is used as part of the Android OS is GPLv2.

Android incorporates other projects, such as Webkit. Webkit uses LGPL and BSD licenses. Android's upstream projects are clearly labeled in the source tree, so there should be no cases where you are expecting Android's Apache 2.0 license but it turns out to be something else.


I understand the complexities of the situation, and I doubt you will get a good answer without paying for it. Which I would not recommend.

As I tell people repeatedly, if you make no money out of it and harm no-one then just do your best, acknowledge the work of others and don't worry too much. If you make money out of your product or services and/or if you may cause damage to someone, you must take competent legal advice. That won't protect you, but it will warn you about the risks and possibly help to mitigate them.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.