Javadoc vs Accessibility

Jonathan Gibbons jonathan.gibbons at oracle.com
Tue Jan 31 00:05:57 UTC 2017


Nicolai,

The simple answer is "Yes, there will be an easy way to generate 
documentation based on accessibility",
and "yes, the javadoc tool is module aware".

We've added new options that generalize the existing simple options, so 
that you can have detailed
control if you really need it, but the existing options will, to a large 
extent, "do the right thing" and should
be sufficient for the common cases.

 From the command-line help, the relevant new options are the following:

     --show-members <value>
                   Specifies which members (fields, methods, etc.) will be
                   documented, where value can be one of "public", 
"protected",
                   "package" or "private". The default is "protected", 
which will
                   show public and protected members, "public" will show 
only
                   public members, "package" will show public, protected and
                   package members and "private" will show all members.
     --show-module-contents <value>
                   Specifies the documentation granularity of module
                   declarations. Possible values are "api" or "all".
     --show-packages <value>
                   Specifies which modules packages will be documented. 
Possible
                   values are "exported" or "all" packages.
     --show-types <value>
                   Specifies which types (classes, interfaces, etc.) will be
                   documented, where value can be one of "public", 
"protected",
                   "package" or "private". The default is "protected", 
which will
                   show public and protected types, "public" will show only
                   public types, "package" will show public, protected and
                   package types and "private" will show all types.


That's a lot of options and a lot of text.

The good news is that you can use the existing simple options, which are now
internally defined in terms of those new options

     -public
           --show-module-contents api --show-packages exported 
--show-types public --show-members public

     -protected   (the long-standing default)
           --show-module-contents api --show-packages exported 
--show-types protected --show-members protected

     -package
           --show-module-contents all --show-packages all --show-types 
package --show-members package

     -public
           --show-module-contents all --show-packages all --show-types 
private --show-members private


There's other useful new options as well:

     --expand-requires <value>
                   Instructs the tool to expand the set of modules to be
                   documented. By default, only the modules given 
explicitly on
                   the command line will be documented. A value of 
"transitive" will
                   additionally include all "requires transitive" 
dependencies of
                   those modules. A value of "all" will include all 
dependencies
                   of those modules.

     --module <module>(,<module>)*
                   Document the specified module(s)

And so, in principle, to generate the current Java SE API documentation, 
you should be able to go

     javadoc ...path.options...  --expand-requires transitive --module 
java.se


Caveat: we are still refining the details of the appearance of some 
pages, particularly the summary
page for a module.


-- Jon


On 01/30/2017 03:28 PM, Nicolai Parlog wrote:
>   Hi!
>
> There is an interesting question up on StackOverflow, "How does the
> Javadoc deal with the visibility of modules in Java 9?".
>
> 	http://stackoverflow.com/q/41929425/2525313
>
> It asks whether there will be an easy way to generate documentation
> based on accessibility?
>
> Next to an actual answer, any pointer to docs would be appreciated as well.
>
>   so long ... Nicolai
>
>
>



More information about the jigsaw-dev mailing list