What is the license for code examples in the JDK's documentation?

For example: The code examples present in this javadoc.

Additionally, in general do code examples embedded in documentation always fall under the main license for a project unless explicitly stated otherwise?

New contributor
lambda is a new contributor to this site. Take care in asking for clarification, commenting, and answering. Check out our Code of Conduct.
  • 1
    At the bottom of the page you are linking it says "All rights reserved. Use is subject to license terms and the documentation redistribution policy." Have you looked at these license terms already? What is your specific question regarding these terms? May 12 at 6:06
  • Ahhhh I don't know how I missed that. Those terms make a lot more sense. It's still not clear to me whether these terms permit the re-use/derivation of a given code example.
    – lambda
    May 12 at 13:42
  • Check this section: "2. License for the Distribution of Compliant Implementations. ..." I think this is pretty restrictive. And you don't have the right to sub-license, so taking the code and using it and then licensing for example under Apache or MIT as part of your own package is not possible. May 12 at 16:08
  • I guess the only other question would then be at what point does a given example stop being considered "trivial" and start being covered under copyright? Those examples from the link in the question look like just about the simplest/most minimal way to implement what is being demonstrated but of course it's java so everything is verbose/complicated. Would they qualify as "trivial"? Also is there a good rule/standard for evaluating triviality?
    – lambda
    May 12 at 17:22
  • 1
    I am not in the position to judge if code can be considered 'trivial'. But there have been questions and discussions here which you might want to read. May 13 at 7:09


Your Answer

lambda is a new contributor. Be nice, and check out our Code of Conduct.

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.