Module API usage questions

Paul Benedict pbenedict at apache.org
Tue Jul 19 20:16:07 UTC 2016


On Tue, Jul 19, 2016 at 3:00 PM, Alan Bateman <Alan.Bateman at oracle.com>
wrote:

> On 19/07/2016 19:38, Paul Benedict wrote:
>
> 3) What is the difference between adding a concealed package and not adding
>> the package at all? If no difference, I don't know why you would ever call
>> ModuleDescriptor.Builder.conceals()
>>
> Concealed packages are packages that are not exported. If you don't add
> them then they will not be package of your module.
>
> When creating a Configuration (like in the above) then they are important
> to know when doing post resolution checks. It's an error, an example, for
> your module M to have a package `p` and for it to read another module that
> exports package p to M.
>


Can you into more about packages "not be package of your module"? I
apologize for not understanding. If I assemble myself a jar file and my jar
file has 10 packages and I have an "empty" module-info.java file (i.e.,
just a name and curly braces), don't I automatically have 10 concealed
packages? So that's what I don't understand -- why I need to tell anyone
what I have hiding.

And what if I don't list out my concealed packages? What happens to my 10
packages at runtime?

Cheers,
Paul


More information about the jigsaw-dev mailing list