a compilation issue caused by the order of two 'requires' directives
Alan Bateman
Alan.Bateman at oracle.com
Wed Jan 18 11:34:48 PST 2012
On 13/01/2012 17:17, Dmitry Bessonov wrote:
> Hello,
>
> While playing with the recent JigSaw build
> I came across a strange compilation issue which exposes
> the inability to resolve module dependences in case
> when two 'requires' clauses are listed in particular order.
>
> The structure is the following - 3 modules are compiled
> and installed one after the other.
>
> module bar @ 1.0 { }
>
> module foo @ 1.0 {
> requires optional bar @>1.0;
> }
>
> module test @ 1.0 {
> requires bar;
> requires foo;
> }
>
> The compilation fails for the last module ('test').
> To compile module successfully it is just needed
> to interchange two 'requires' clauses in module 'test'.
>
> Best regards,
> Dmitry
This is indeed confusing and a reminder that the resolver will need good
diagnostics so that javac and install/other time resolution can emit
helpful messages.
I believe that when the 3 module-info files are compiled together that
the resolver will be called with all 3 in the root query set and that it
will fail as expected (because bar at 1.0 doesn't satisfy the needs of both
foo and test).
When compiled individually then it does appear that there is an issue. I
believe foo will compile because the configuration for foo will be
computed (won't fail because the bar@>1.0 is an optional dependency).
However when it comes to test then it does appear that the order changes
changes. Jon - is there any possibility that the order issue is due to
the Catalog implementation in javac? If not then I guess this means
going through the resolver trace to see what is going on.
-Alan
More information about the jigsaw-dev
mailing list