/* (非 javadoc)含义

发布于 2024-10-20 00:38:33 字数 456 浏览 6 评论 0原文

可能的重复:
“/*(非javadoc)”是否具有易于理解的含义?

下面的语句是什么意思?

    /* (non-Javadoc)
     * 
     * Standard class loader method to load a class and resolve it.
     * 
     * @see java.lang.ClassLoader#loadClass(java.lang.String)
     */
    @SuppressWarnings("unchecked")

Possible Duplicate:
Does “/* (non-javadoc)” have a well-understood meaning?

What does the following statements mean?

    /* (non-Javadoc)
     * 
     * Standard class loader method to load a class and resolve it.
     * 
     * @see java.lang.ClassLoader#loadClass(java.lang.String)
     */
    @SuppressWarnings("unchecked")

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

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

发布评论

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

评论(4

兮颜 2024-10-27 00:38:33

Javadoc 查找以 /** 开头的注释。
按照传统,不打算成为 java 文档一部分的方法注释以“/*(非 Javadoc)”开头(至少当您的开发环境是 Eclipse 时)。

顺便说一句,避免在方法内使用多行注释。例如,避免这种情况:

public void iterateEdges()
{
  int i = 0;

  /* 
   * Repeat once for every side of the polygon.
   */
  while (i < 4)
  {
  } 
}

首选以下方式:

public void iterateEdges()
{
  int i = 0;

  // Repeat once for every side of the polygon.
  while (i < 4)
  {
    ++i;
  } 
}

原因是您可以注释掉整个方法:

/*
public void iterateEdges()
{
  int i = 0;

  // Repeat once for every side of the polygon.
  while (i < 4)
  {
     ++i;
  } 
}
*/

public void iterateEdges()
{
  // For each square edge.
  for (int index = 0; index < 4; ++index)
  {
  }
}

现在,您在实现新方法时仍然可以看到旧方法的行为。这在调试时也很有用(以简化代码)。

Javadoc looks for comments that start with /**.
By tradition, method comments that are not intended to be part of the java docs start with "/* (non-Javadoc)" (at least when your dev environment is Eclipse).

As an aside, avoid using multi-line comments inside methods. For example, avoid this:

public void iterateEdges()
{
  int i = 0;

  /* 
   * Repeat once for every side of the polygon.
   */
  while (i < 4)
  {
  } 
}

The following is preferred:

public void iterateEdges()
{
  int i = 0;

  // Repeat once for every side of the polygon.
  while (i < 4)
  {
    ++i;
  } 
}

The reason is that you open the possibility to comment out the entire method:

/*
public void iterateEdges()
{
  int i = 0;

  // Repeat once for every side of the polygon.
  while (i < 4)
  {
     ++i;
  } 
}
*/

public void iterateEdges()
{
  // For each square edge.
  for (int index = 0; index < 4; ++index)
  {
  }
}

Now you can still see the old method's behaviour while implementing the new method. This is also useful when debugging (to simplify the code).

南风几经秋 2024-10-27 00:38:33

当程序员要求 Eclipse 将 Javadoc 注释添加到 [编辑:Eclipse 认为] Javadoc 工具实际上不会使用它的位置中的某些代码时,我看到 Eclipse 生成了这条消息。

一个常见的例子是在类实现的接口中实现方法(在 Java 6 中需要 @Override 注释)。 Javadoc 将使用放在INTERFACE 中的方法上的 javadoc,而不是实现中提供的 javadoc。

其余的评论很可能是由一个不知道这一点的人写的。

I have seen this message generated by Eclipse when the programmer asks Eclipse to add a Javadoc comment to some code in a location where [EDIT: Eclipse thinks] the Javadoc tool will not actually use it.

A common example is the implementation of a method in an interface implemented by the class (which in Java 6 needs the @Override annotation). Javadoc will use the javadoc placed on the method in the INTERFACE, not the one provided in the implementation.

The rest of the comment was most likely written by a person that did not know this.

挽袖吟 2024-10-27 00:38:33
/*
 * This is the typical structure of a multi-line Java comment.
 */

/**
 * This is the typical structure of a multi-line JavaDoc comment.
 * Note how this one starts with /** 
 */
/*
 * This is the typical structure of a multi-line Java comment.
 */

/**
 * This is the typical structure of a multi-line JavaDoc comment.
 * Note how this one starts with /** 
 */
始终不够爱げ你 2024-10-27 00:38:33

这只是一条正常的评论。该注释意味着,如果您创建 javadoc 手册基础,则不会添加此文本。

It's just a normal comment. The note means, if you create a manual, base of javadoc, this text won't be added.

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