Implied readability + layers

Ali Ebrahimi ali.ebrahimi1781 at gmail.com
Fri Nov 6 19:18:49 UTC 2015


Hi,

On Fri, Nov 6, 2015 at 8:18 PM, Alan Bateman <Alan.Bateman at oracle.com>
wrote:

>
>
> On 06/11/2015 10:59, Ali Ebrahimi wrote:
>
>> :
>>
>> module com.foo {
>>          requires com.baz;
>>
>>          exports com.foo;
>>
>> }
>>
> In this example then com.foo will also need to require com.bar as
> otherwise com.foo will not compile (I assume you've deliberately removed
> the requires public for this example).
>
This is my bad, I emitted requires public when typing mail.
The is correct version:

module com.baz{
          requires public  com.baz;
          exports com.bar;
}

Stil result is:

foo.canRead(bar2) -> true
foo.canRead(bar1) -> false
baz.canRead(bar1) -> true
baz.canRead(bar2) -> false
bar1
bar2


But:
I figure out what is problem here:
If you try this sample once with exploded modules and then with modular
jars you will found.

Also, if you remove com.bar from root module list for cfg2 final result
will change:

 Configuration cfg2 = Configuration
                .resolve(finder2, layer1,ModuleFinder.empty(),"com.foo")
                .bind();

So all of this can not cause hard to find bugs in user applications.




-- 

Best Regards,
Ali Ebrahimi


More information about the jigsaw-dev mailing list