On 2018-01-01 Stefan Bodewig wrote:
> On 2017-12-31, Lasse Collin wrote:
> > Would it be too complicated to turn XZ into a proper module? How
> > useful is that?  
> As XZ hasn't got any dependencies you'd only benefit from an explicit
> module info if you wanted to restrict the set of packages you
> expose.

This could be nice, but in practice there's no reason for anyone to use
the internal (unstable) APIs. If someone does, he can blame himself. ;-)

> Otherwise I think Automatic-Module-Name would achieve exactly
> the same thing that you could achieve with an explicit
> module-info.java. At least for now. module-info.java may give you more
> control in the long term, though.

OK. It can be added later if needed.

> > From what I read, it needs module-info.java which should be easy to
> > write as XZ doesn't depend on external packages. I don't know how to
> > set it up with Ant. It would be very good if XZ could be built on
> > older JDKs too, even if those compilers cannot build the
> > module-info.java file.  
> You could check for JDK9 and only compile module-info.java if you
> found it. That way XZ compiled with Java8 or earlier wouldn't be a
> proper Java9 module and one compiled with Java9 would contain the
> module descriptor.
> Assuming you'd want to target Java7 and compile module-info.java if
> Ant was actually on Java9 something like the patch below should do
> it. Here module-info.java would be compiled by a separate javac task
> that comes up with an empty set of sources to compile on Java8 and
> earlier.

Thanks, this looks exactly like what I asked. I think I will build the
next release with -source 1.5 -target 1.5 and thus not with OpenJDK 9.
So module-info.java will need to wait for now.

Lasse Collin  |  IRC: Larhzu @ IRCnet & Freenode

Reply via email to