How does the Javadoc deal with the visibility of modules in Java 9?

前端 未结 1 1594
北恋
北恋 2020-12-28 15:31

The Javadoc tool generates documentation based on the accessibility modifier. By default, it document all public and protected classes, fields and

相关标签:
1条回答
  • 2020-12-28 16:21

    javadoc has new options that allow you to select which items are documented at the module, package, type and member level. Using an EA version of JDK 9, look for new --module, --show-* options, and --expand-requires options.

    The existing options -public, -protected, -package, -private options have been redefined in terms of the new --show-* options, although their command line help still needs to be updated.

    The handy-dandy conversion table is:

    -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
    
    -private
          --show-module-contents all --show-packages all --show-types private --show-members private 
    

    In general, continue to use the default to generate documentation for users of an API, and maybe use -package or -private to generate documentation for the developers of an API. For more fine-grain control, use the underlying --show-* options.

    0 讨论(0)
提交回复
热议问题