Re-export and isModulePresent
Mandy Chung
mandy.chung at oracle.com
Fri Feb 17 12:06:51 PST 2012
On 2/17/2012 7:45 AM, Alexey Fedorov wrote:
> Hello!
>
> Suppose we have the following module structure:
>
> module A @ 1.0 {
> ...
> }
>
> module B @ 1.0 {
> ...
> requires public A;
> }
>
> module C @ 1.0 {
> ...
> requires B;
> }
>
> the following call in any class from module C returns *false*:
>
> getClass().getModule().isModulePresent("A")
>
> Is this behavior correct? In other words, "requires public A"
> directive re-exports *only A's types*, not *module *A?
It's a bug. One use case of the isModulePresent() method is for testing
if an optional module exists so that the a caller can conditionally
reference the exported types from that module. In your example, module
C should be able to access types in A that are re-exported from B if A
is installed and linked with C. So the isModulePresent("A") method
should return true in this case and we will fix it.
Mandy
More information about the jigsaw-dev
mailing list