exports lint is perhaps a little overzealous

Remi Forax forax at univ-mlv.fr
Fri Apr 28 19:31:31 UTC 2017


javac output warnings when an annotation on public methods or a public class of an exported package comes from a dependencies which is not declared as transitive.

I believe that annotations are not really part of the API so should not be checked by exports linter.
In my case, the annotation is the JUnit5 @Test, given how JUnit works, the method is always called by reflection so having a requires transitive makes little sense.


target\test\merged\com.github.forax.pro.api\com\github\forax\pro\api\helper\CmdLineTests.java:9: warning: [exports] class Test in module junit.jupiter.api is not indirectly exported using requires transitive
  @Test
   ^
target\test\merged\com.github.forax.pro.api\com\github\forax\pro\api\helper\CmdLineTests.java:15: warning: [exports] class Test in module junit.jupiter.api is not indirectly exported using requires transitive
  @Test
   ^
target\test\merged\com.github.forax.pro.api\com\github\forax\pro\api\helper\CmdLineTests.java:22: warning: [exports] class Test in module junit.jupiter.api is not indirectly exported using requires transitive
  @Test
   ^
target\test\merged\com.github.forax.pro.helper\com\github\forax\pro\helper\FileHelperTests.java:11: warning: [exports] class Test in module junit.jupiter.api is not indirectly exported using requires transitive
  @Test
   ^

regards,
Rémi


More information about the compiler-dev mailing list