This is one example where Jigsaw is taking on too much responsibility and
it shows. Transitive dependencies is a tricky subject. The reason
transitive dependencies are meant to exist is to bring along common
features.... but professional build tools allow me to exclude them. AFAICT,
Jigsaw does not allow me to exclude transitive dependencies. So it begs the
question: should it? The answer is neither yes nor no. It should be that
transitive dependencies should not be a feature of Java. That belongs to
the realm of build tools that determine what should be available based on
my project configuration -- not my source code.

In this example, importing "java.sql" drags in two more required modules,
but how did that assumption get made? What if I have no interest in using
the types of "java.logging" and "java.xml"? My module graph just grew by 2
for reasons outside of my control. The assumption here is too big. Java
should *not* be trying to do module management for me.

Cheers,
Paul

On Tue, Jul 26, 2016 at 3:27 PM, Malachi de Ælfweald <malac...@gmail.com>
wrote:

> I would not expect to specify any transitive dependency.  I would not
> expect any user of my API to have to manually specify any transitive
> dependencies I used in my public API (return types for example).  If they
> did - that completely breaks the point of me specifying transitive
> dependencies in the first place.
>
>
>
> Malachi de Ælfweald
> http://www.google.com/profiles/malachid
>
> On Tue, Jul 26, 2016 at 11:35 AM, Paul Benedict <pbened...@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
>>
>
>

Reply via email to