Weakness of "requires public"

Stephen Colebourne scolebourne at joda.org
Wed Jul 27 15:55:34 UTC 2016


I find "requires public" to be sensible enough and a useful tool. I
agree that there may be cases where it would be desirable to block
such dependencies. There may already be a command line flag to do
that, but an addition to module-info may also make sense.

Stephen


On 26 July 2016 at 19:35, Paul Benedict <pbenedict at apache.org> wrote:
> In a modularized world, I don't see "requires public" delivering the value
> it should.
>
> Let's take this example:
> module java.sql {
>     requires public java.logging;
>     requires public java.xml;
>     exports java.sql;
>     exports javax.sql;
>     exports javax.transaction.xa;
> }
>
> Given a theoretical Maven POM representing the "java.sql" module, the POM
> would have to list out the other two modules so that my project compiles
> against all declared modules. It is considered bad practice to compile
> against artifacts I did not declare in my POM. There are three artifacts
> here.
>
> Would any Maven experts here disagree? I see the positive of "requires
> public" to be negated in build systems. Given what I just found, I do not
> like the idea of public transitive dependencies in the Module Descriptor.
> For developers using build systems, I believe "requires public" should be
> avoided.
>
> Cheers,
> Paul


More information about the jigsaw-dev mailing list