exports directive

David Holmes david.holmes at oracle.com
Tue Jun 19 04:22:42 PDT 2012


On 19/06/2012 8:06 PM, Jaroslav Tulach wrote:
> Dne Út 19. června 2012 13:17:24, David Holmes napsal(a):
>> On 19/06/2012 1:10 PM, Mandy Chung wrote:
>>> On 6/18/2012 7:20 PM, David Holmes wrote:
>>>> Does export work like a prefix such that
>>>>
>>>> exports foo;
>>>>
>>>> means the module exports all types in package foo, plus all types in
>>>> all subpackages of foo? Or do I need to use multiple exports
>>>> directives, or wildcards?
>>>>
>>> |exports| takes a qualified identifier indicating a package name. You
>>>
>>> need to use multiple |exports| directives to list its subpackages:
>>> |module foo {
>>>
>>> exports foo;
>>> exports foo.spi;
>>> exports foo.util;
>>> }
>>>
>>>> And is this documented somewhere?
>>>
>>> http://openjdk.java.net/projects/jigsaw/doc/lang-vm.html
>>> http://cr.openjdk.java.net/~mr/jigsaw/notes/jigsaw-big-picture-01
>>
>> Thanks Mandy!
>>
>> Annoyingly tedious to have to list all the subpackages directly though.
>> Libraries that make extensive use of subpackages for grouping things
>> will need to use long exports lists. Some kind of wildcard support would
>> be quite useful I think.
>
> A tools perspective: Wildcards are pain to support. Example: just by looking
> at module-info.java one cannot deduce list of exported packages. One needs to
> examine all module source files. Tedious.
>
> A user perspective: While wildcards save some time initially, they usually
> bite you back after few years of maintenance. Also they don't work well when
> somebody adds org.myorg.myexportedapi.internal package, which is a common
> pattern used by some open source projects.

I suppose once we have tools to assist in generating the module-info the 
point will be moot. But here today I would have liked to have had a 
wildcard. ;-)

YMMV.

David


> -jt
>



More information about the jigsaw-dev mailing list