Compile time vs. runtime deps
Jaroslav Tulach
jaroslav.tulach at oracle.com
Wed Jul 11 06:24:02 PDT 2012
Dne St 11. července 2012 18:33:41, David Holmes napsal(a):
> On 11/07/2012 5:22 PM, Jaroslav Tulach wrote:
> > Dne St 11. července 2012 08:59:20, Paul Sandoz napsal(a):
> >> On Jul 11, 2012, at 8:28 AM, David Holmes wrote:
>
> > I believe both cases are possible. I can have optional dependency I need
> > to
> > compile against and I can as well have another optional dependency I don't
> > need to compile against.
> >
> > There needs to be a way to express that properly to Jigsaw runtime as well
> > as Javac.
>
> I don't see why I need to make the distinction to the compiler. I
> declare an optional dependency and at compile-time it is, or isn't
> found.
That could produce different result during the compilation. The compilation
could either succeed or fail. Javac and IDEs need to know whether the optional
(in runtime) library should or should not be on the compilation "classpath".
> During compilation I reference a type and a module for that type
> is, or isn't, found. Whether the module was omitted or was optional it
> is simply a compile-time error if the type is not found. (I don't expect
> javac to know or determine that the not-found type would have been found
> in the missing optional module - how could it?)
The Javac and IDEs have to know. My proposal was to introduce some way of
telling the system that there is a compile time only dependency. Thus for the
case when you want a fully optional dependency you could say:
requires optional m at 1.0;
which would mean "m at 1.0" should not be present while compiling. Or one could
use
requires compile optional m at 1.0;
which would make the "m at 1.0" optional during execution, but Javac and other
source processing tools would know that it has to be present.
-jt
> > This is another example when runtime and compile time dependencies may
> > differ. The first one I know is the list of annotation processor providing
> > modules to be present when compiling, but not during execution.
> >
> > Time to introduce "requires compile m at 1.0"?
> > -jt
More information about the jigsaw-dev
mailing list