Why does the package-info.java file affect annotat

2019-06-13 03:44发布

问题:

Adding a package-info.java file to the project, causes annotation-processors to create different output.

I don't understand why this happens. I think adding the package-info.java file should not affect my build at all, because it does not contain any fancy stuff (like Annotations, etc.). It only contains the simplest package declaration:

package com.example;

I've managed to create a minimal project to reproduce the issue with javac only. The project has too much code to post here on StackOverflow, so I've published the project on GitLab: including the full source-code and a very detailed README file.

Any ideas why this happens or what could be the cause? Is it maybe a java-bug?

Notes

  • the project uses a jar file color-1.0-SNAPSHOT.jar as library, which:
    • uses the same annotation processor
    • uses the same package (in the real project, we must use the same package name in different modules to use the java package-scope)
  • the problem can also be reproduced in an Android project with another annotation processor: see this SO question