gpt4 book ai didi

javadoc @hide 无法工作

转载 作者:行者123 更新时间:2023-11-30 08:05:23 25 4
gpt4 key购买 nike

根据link ,我写了下面的代码:

/**
* @hide
* */
public void myMethod() {
// do something
}

当我使用命令生成文档时:

$ javadoc -locale en_US -encoding UTF-8 -charset UTF-8 -d doc xxx.java

文档仍然有 myMethod 项。那么如何隐藏myMethod呢?我错过了什么?

最佳答案

您正在使用 Doclava标记,但正在使用标准 doclet 生成 API 文档。

Building Doclava

The Doclava source comes bundled with an ant script to build the doclet. The "jar" task will build a jar containing Doclava and all necessary dependencies.

Using Doclava with Javadoc

The command line arguments to pass to Javadoc to use Doclava are: -doclet com.google.doclava.Doclava -docletpath ${jar.file}

根据官方Javadoc FAQ , 目前无法直接隐藏公共(public)成员。

Occasionally you might need to make a class or method public so that it can be accessible from other packages, not because you want it to be part of the public API. Having these methods appear in the documentation merely confuses application developers.

There is currently no Javadoc option to hide, exclude or suppress public members from the javadoc-generated documentation.

Several options are available:

  • Excluding source files - You can pass into javadoc only the source filenames for all classes you want to document, and exclude those you want to omit. Notice this has the granularity of files, not classes. Therefore, if you exclude a source file that contains nested classes, they would also be excluded. (You can put the list of classes in a command line argument file rather than directly on the command line.) The default Javadoc offers no way to omit classes when passing in package names on the command line.
  • Excluding individual classes - You can use the Exclude Doclet. This has finer granularity (class rather than source file) than the previous option, and would be more natural to use because you explicitly list in a file the files you want to exclude.
  • Excluding classes, methods and fields - The yDoc Doclet has this capability, where you mark items with an exclusion tag in the source code. In addition, anyone is welcome to extend the Exclude Doclet above for methods and fields -- we'd be happy to publish it and add your name to the credits.

We are considering @exclude as a proposed tag for excluding members.

另请查看 Proposed Javadoc Tags page有关 @exclude@hide 的更多信息。

关于javadoc @hide 无法工作,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/35076307/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com