javadoc 中的 -nodeprecated 选项似乎不起作用。我能做些什么?

发布于 2024-08-18 12:46:48 字数 469 浏览 2 评论 0原文

我的类中有一个已弃用的方法:

@Deprecated
public void deprecatedMethod() {
   //do bad things
}

我不希望该方法出现在 javadoc 中。 我知道有一个名为 -nodeprecated

“防止生成任何 完全不推荐使用 API 文档。”

我使用这个选项,它不会从 javadoc 中排除该方法。这是 javadoc 中的错误还是我使用错误?我还能做什么?

(我正在使用 eclipse 3.4.2生成 javadoc)

I have a deprecated method in my class:

@Deprecated
public void deprecatedMethod() {
   //do bad things
}

I don't want that method to appear in the javadoc.
I know there's an option called -nodeprecated which:

"Prevents the generation of any
deprecated API at all in the
documentation."

So I'm using this option and it doesn't exclude the method from javadoc. Is it a bug in javadoc or am I using it wrong? What else can I do?

(I'm using eclipse 3.4.2 to produce javadoc)

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

囚你心 2024-08-25 12:46:48

您必须在导出到 javadoc 向导中包含“-nodeprecated”选项。
警告:这是一个 javadoc 选项,而不是 VM 选项。

我已经在 Eclipse 3.4 中测试过它并且有效。

编辑:如果您仅包含“已弃用”注释,则该注释不起作用。您还必须在方法 javadoc 中包含 @deprecated 标记。

我不知道是否有办法告诉 javadoc 使用 @Deprecated 注释(奇怪的是它没有消息参数来记录为什么被弃用以及还可以使用什么)。

编辑: before-1.5 弃用方法的方式

您必须在 javadoc 中“已弃用”之后包含一个 @deprecated 标记(或指示符或其他内容)以及要在 javadoc 中向用户显示的消息”。

/**
  This method sets the property A.
  @see getA
  @author helios
  @deprecated This method is not sync safe, use setAOk instead
 */
public void setA(String value) ...

You have to include "-nodeprecated" option in the Export to javadoc wizard.
Warning: it is a javadoc option, not a VM option.

I've tested it in Eclipse 3.4 and it worked.

Edit: If you only include Deprecated annotation it doesn't work. You have to include @deprecated tag inside method javadoc as well.

I don't know if there's a way to tell javadoc to use @Deprecated anotation (which curiously doesn't have a message parameter to document why is deprecated and what else to use).

Edit: before-1.5 way of deprecate methods

You have to include a @deprecated tag (or indicator or whatever) with the message you want to display to the user in the javadoc after the "deprecated".

/**
  This method sets the property A.
  @see getA
  @author helios
  @deprecated This method is not sync safe, use setAOk instead
 */
public void setA(String value) ...
我只土不豪 2024-08-25 12:46:48

@helios

john 说您必须在 javadoc 注释块 (/** ... */) 中包含 @deprecated javadoc 标记,就像他在上面所做的那样:

@deprecated This method is not sync safe, use setAOk instead

添加此内容,然后在运行 javadoc 时使用 -nodeprecated 选项,并且方法不会出现在生成的文档中。

@helios

john is saying that you must include the @deprecated javadoc tag within the javadoc comment block (/** ... */) as he has done above with:

@deprecated This method is not sync safe, use setAOk instead

Add this, then use the -nodeprecated option when running javadoc and the methods will not appear in the generated doc.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文