Requires, Exports, and Provides

Paul Benedict pbenedict at apache.org
Fri Nov 27 13:47:21 UTC 2015


Tim, I would agree with you if only packages were being listed. However, I
find the readability difficult because modules, packages, and classes are
all being referenced together. Also, with module names being recommended to
be like package names (and often identically named!), I find it more
difficult than necessary to read the source file with my eyes. I really
want readability to be king here.
On Nov 27, 2015 4:22 AM, "Tim Ellison" <Tim_Ellison at uk.ibm.com> wrote:

> Hello Paul,
>
> Being explicit would help if there were any ambiguity about the
> declaration, and I'm not convinced that adding the additional syntax would
> be helpful here.
>
> In particular, the current pattern, e.g. "exports java.sql;" fits with
> the existing syntax for an import statement.  That is, we write
>
>    import java.sql.Timestamp;
> or
>    import java.sql.*;
>
> and not "import class" and "import package"
>
> As for the service provider, I guess it is a matter of taste, but I'm
> comfortable that the service interface is more prominent than the
> implementation type.
>
> Regards,
> Tim
>
>
> Paul Benedict <pbenedict at apache.org> wrote on 25/11/2015 22:48:42:
> > Dear EG members, are you still refining syntax? If so, I would like you
> to
> > consider making the keywords a bit more explicit regarding "requires",
> > "exports", and "provides/uses" by adding "module", "package", and "class"
> > respectively.
> >
> > Personally, I find the explicitness to be much more instantly readable.
> > WDYT?
> >
> > module java.sql {
> >     requires module java.logging;
> >     requires module java.xml;
> >     exports package java.sql;
> >     exports package javax.sql;
> >     exports package javax.transaction.xa;
> >     provides class java.sql.Driver with com.mysql.jdbc.Driver;
> > }
> >
> > module java.base {
> >     ...
> >     exports package to
> >         module java.corba,
> >         module java.logging,
> >         module java.sql,
> >         module java.sql.rowset,
> >         module jdk.scripting.nashorn;
> > }
> >
> > I also think you could replace "with" with "for" if you flip the
> ordering:
> > provides class com.mysql.jdbc.Driver for java.sql.Driver;
> >
> > Cheers,
> > Paul
> >
>
>



More information about the jpms-spec-comments mailing list