On 06/11/2015 19:18, Ali Ebrahimi wrote:

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.

Right, I think you are running into issue again where the two versions of com.bar have equal ModuleDescriptors. When you create modular JAR then I'm guessing you add a module version and this makes them non-equal.

For the exploded module case then you could changing one of them to "export com.bar.extra" to make them non-equal. This is just temporary until we get the API changed as I mentioned in some of the other mails.


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.

Yes, nobody requires com.bar in the configuration for layer2 and so com.bar@2 is ignored.

-Alan

Reply via email to