I'm building a Java annotation processor and looking for the correct license to use with respect to some requirements (see below).

Basically, a user of this tool:

  • depends on it during compilation (it is a Maven artefact with provided scope, the common/only way of specifying a dependency as only compile and not runtime),
  • refers to a Java annotation in their own code (marked as source-only retention, i.e., it is discarded by the compiler) on their own Java interfaces,
  • gets a generated Java source file that contains some structural specificity from the tool but is simply a derivative of the annotated interface and only refers to their own code (or its dependencies).

The project is the following: https://github.com/victornoel/eo-envelopes (notice that I answered the question in the README, but I am not actually confident about it).

My question:

  • I would like to distribute it under a license like the GPLv3.0 (dependencies are MIT or Apache 2.0),
  • while letting anybody use it even in proprietary software.

But I'm not 100% sure it is a valid use of the GPL here, I've identified 3 potentially problematic points:

  • the compile time dependency
  • the generated code
  • the reference to the annotation in user code
  • anything else?

This is probably OK, depending on the licensing status of the code that you generate.

  1. You only hold the copyright to your annotation processor. You do not hold any copyright to the user's programs. The user's programs are merely input data to your processor. Your annotation processor uses automated techniques to transform the input, which does not produce a new copyrightable work. As you do not hold any copyright to the output, you cannot impose any license on that output even if you wanted to.

  2. Your processor may include templates, or may copy snippets into the output. You hold the copyright for any such templates or snippets. If you license your project under the GPL, this license also extends to these templates or snippets. The output is derived from these templates or snippets, so the output would be subject to the GPL. This reasoning does not apply if the templates and snippets are so trivial that they are not copyrightable.

    If you your processor copies templates or snippets into the output, you may want to clarify their status by adding an exception to the GPL to your license. This is possible under the GPLv3 Section 7 “Additional Terms”.

I have skimmed your project, and there don't seem to be any substantial snippets or templates to which the second point would apply. I would just add an informal note to your README that the output of your processor can be used without any restrictions.

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

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