Proposal: #CompileTimeDependences: `requires static`

forax at forax at
Wed Jun 29 10:01:03 UTC 2016

----- Mail original -----
> De: "Simon Nash" <simon at>
> À: "mark reinhold" <mark.reinhold at>
> Cc: "Remi Forax" <forax at>, jpms-spec-observers at
> Envoyé: Mercredi 29 Juin 2016 10:20:25
> Objet: Re: Proposal: #CompileTimeDependences: `requires static`
> mark.reinhold at wrote:
> > 2016/6/28 15:50:52 -0700, Remi Forax <forax at>:
> >> Apart the fact that 'static' should be spelled 'optional', there is no
> >> reason to reuse static as it doesn't convey the semantics we want,
> >> i.e. optional at runtime, i fully agree with this proposal.
> > 
> > In this context `static` is intended to mean "at compile time" or,
> > equivalently, before the more "dynamic" phases of run time and link
> > time (the latter of which is more like run time than compile time).
> > 
> > I agree that `static` is potentially confusing since its meaning here
> > is different from what `static` means when used on a member of a class.
> > 
> > It does, however, fit nicely with its (nearly) dual directive, `exports
> > dynamic`, proposed for #ReflectiveAccessToNonExportedTypes.
> > 
> > I think `optional` is a non-starter, since `requires optional` reads as
> > an oxymoron, and it's optional at run time but mandatory at compile
> > time, so in what sense is it, really, "optional"?
> > 
> > Suggestions of other alternatives are welcome ...
> > 
> > - Mark
> > 
> I agree with Remi that 'static' isn't a good choice.  One the nice
> improvements of Java over C was Java's cleaner and more consistent usage
> of the 'static' keyword.
> How about 'requires import' or 'requires imported'?  This is consistent
> with the current usage of 'import' to declare compile-time dependencies
> on other packages.
>   Simon

yes, optional comes from OSGI where you can optionally import something,
optional make more sense for OSGI because OSGI only works at runtime so optional is implicitly optional at runtime.

The issue with 'import' meaning compile time only is that more Java developers than we want doesn't make the difference between import in Java and say import in Python.

so what about 'compileonly' ?


More information about the jpms-spec-observers mailing list