Why does the package-info.java file affect annotation-processing?

那年仲夏 提交于 2019-12-23 05:16:36

问题


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

来源:https://stackoverflow.com/questions/45412736/why-does-the-package-info-java-file-affect-annotation-processing

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!