5

I have written a Java class Sequence that presents a similar interface to Stream, but with some changes. For convenience I copied the Javadoc comments from Stream, adapting them as necessary for my own code. I have included a copyright notice (namely Oracle) for the copied comments, but I'm unsure about the licence implications. Stream is released under GPL v2, which I understand requires that any derived work be similarly licensed. But does the GPL licence cover only the code proper, or does it also include comments? I would like to release my code under the MIT licence, but I'm unsure whether my inclusion of comments from Stream obliges me to release it under GPL v2 instead.

3
  • 2
    If you included comments from Stream when writing Sequence, is it reasonable to conclude that you studied Stream before and during the writing of Sequence?
    – MadHatter
    Commented Nov 16, 2023 at 15:15
  • Its documentation, yes, but not its code Commented Nov 16, 2023 at 16:22
  • The OpenJDK Stream.java implementation is GPLv2+classpath licensed. But the spec itself is not licensed that way, and there's nothing requiring that independent implementations of that spec be licensed that way. See the license notices if you're curious: docs.oracle.com/javase/8/docs/api/?java/util/stream/Stream.html
    – Brandin
    Commented Nov 24, 2023 at 10:34

2 Answers 2

4

But does the GPL licence cover only the code proper, or does it also include comments?

The GPL license is a copyright license and it applies to all parts of a project that are subject to copyright protection.

Copyright law provides copyright protection for things that are the result of a human creative process and that includes both source code, documentation and comments. There is an exception here in the form of the Merger doctrine, which states that if there is only one (or a very few limited) way to express an idea, then the expression is not copyright protected.

I would like to release my code under the MIT licence, but I'm unsure whether my inclusion of comments from Stream obliges me to release it under GPL v2 instead.

Unless those comments are the only way to write the needed information, copying those comments from Stream means that you have included GPLv2 content in your project and you need to use the GPL license yourself as well.

1

Missing any other statement, I expect the Javadoc comments from Stream to be under GPL as well.

One argument would be that of fair use. For example, if you included in your comment a relevant quote (e.g. from an standard). But I don't think it really fits this case.

Could you have different licenses for code and comments? I think you could, but the result is quite sketchy. Comments and code are clearly separated, so you could e.g. state that comments are available under CC-BY and code under GPL, I think there are some projects in that vein. The opposite is more peculiar. And, since code and comments will be on the same file (as opposed to having some GPL files with documentation and some different MIT files with code) it's more complicate to present to the final users.

I think you could release your whole project under GPL, with the provision that it can be used under a MIT license if they remove the comments from the code.

I would recommend to just write new comments from the ground up, though.

1
  • Thank you. That's a useful perspective. Commented Nov 18, 2023 at 23:01

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.