version omitted

Mark Reinhold mr at sun.com
Tue Dec 15 15:12:42 PST 2009


> Date: Wed, 09 Dec 2009 18:39:24 -0800
> From: jonathan.gibbons at sun.com

> If a version is omitted from a module-info file, whose job is it to determine a
> default, and if it is javac's job, what should the default be?

Good question.  The slightly-more-general question of whether a module id
must have a non-empty version component has been an open issue from the
beginning.

Some possibilities:

  (1) A version is always required.  If a module's declaration doesn't
      specify a version then javac (1a) reports an error or (1b) inserts
      some default value.

  (2) A version is optional.  If a module's declaration doesn't specify
      a version then javac simply doesn't record one in the module-info
      class file.

Option (2) raises another question, however: If a module has no version
then which module-id queries, if any, will it satisfy?

Modules without versions are, I think, a bit like the unnamed package.
They could well arise in casual development and experimentation but are
unlikely to be used, for long, in real projects.  On that basis I'm
tempted to say that a module without a version will only satisfy a
module-id query without a version, and that a module with a version is
always preferred over a module without a version.

At the moment, (2) seems the best choice to me.  It makes for an easier
learning/migration path.

It would be interesting to look at what other module(-like) systems do
in this case.

- Mark



More information about the jigsaw-dev mailing list