Javadocs - @param 名称未找到

Javadocs - @param name not found

我正在尝试记录我的一个 类,但我不断收到同样的错误,我不明白为什么或如何解决它。

这是代码的相关部分:

/** Set the health. 
    @param health The health of the enemy */
    public void setHealth(float health) {
        this.health = maximum_health;
    }

    /** initialising */
    public void initialise() {
        setName("NONE");
    }

    /** Constructor for the base enemy
    @param name The name of the enemy
    @param health The health of the enemy */
    public BaseEnemy(String name) { 
        initialise();
        setName(name);
        setHealth(health);
        }

我在记录时遇到的错误如下:

Generating code/classes/docs/baseDoc/com/ama747/enemies/BaseEnemy.html...
code/src/BaseEnemy/BaseEnemy.java:27: error: @param name not found
    @param health The health of the enemy */

我的问题如下:是什么导致了我的错误,我该如何解决?

这是格式问题:

/**
 * 
 * @param health he health of the enemy
 */
public void setHealth(float health) {
    this.health = maximum_health;
}

问题说的很对。您的构造函数中没有名为 'health' 的参数。

正如@мхѕτавєւмo 指出的那样,这似乎是一个格式问题。 Javadocs 注释必须以 /** 开头,必须以 */ 结尾,额外的行以 * 开头。根据 javadoc 文档,它是强制性的:

http://www.oracle.com/technetwork/articles/java/index-137868.html

The special comments in the Java source code that are delimited by the /** ... */ delimiters. These comments are processed by the Javadoc tool to generate the API docs.

在您最初的例子中,这些规则没有得到遵守。