----- Mail original ----- > De: "Anand Beh" <anande...@gmail.com> > À: "jigsaw-dev" <jigsaw-dev@openjdk.java.net> > Envoyé: Jeudi 3 Juin 2021 22:10:11 > Objet: Annotation Dependencies and Requires Static Transitive
> Hello, > > The cache library Caffeine recently added a full module descriptor. It > has no runtime dependencies, but it depends on metadata annotations > from checker-qual and errorprone, for example @NotNull and > @CanIgnoreReturnValue. The module looks like this: > module com.github.benmanes.caffeine { > exports com.github.benmanes.caffeine.cache; > exports com.github.benmanes.caffeine.cache.stats; > > requires static transitive com.google.errorprone.annotations; > requires static transitive org.checkerframework.checker.qual; > } > > The annotations are not required at runtime, hence static. They're > visibly placed on public methods and return types, so that API clients > can benefit from them for the purposes of annotation-based null > analysis, kotlin interop, etc. As the annotations are part of the API, > they're marked transitive. > > However, the "transitive" aspect imposes some requirements on users. I > am wondering if there is a more correct way to declare these > annotation dependencies than static transitive. > > One user would like to avoid the presence of these annotations at > compile-time. For reference, here's the relevant discussion: > https://github.com/ben-manes/caffeine/issues/535 > > I'm not a maintainer of caffeine, though I was involved in its modularization. Hi, i've used just "requires static" without "transitive" for non null/nullable annotations in the past. Thos annotations are consumed by tools, i don't think transitive is necessary. > > Regards, > Anand regards, Rémi