本文介绍了如何在Javadoc中添加包级注释?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用Check-Style,FindBugs和PMD来验证我的Java代码。我已经修复了几乎所有这些工具捕获的错误。



我无法理解如何编写package comment,这是checkstyle捕获的错误。我已经阅读了Check-Style的文档,但我不明白。



有人可以帮我在Java中编写包级别的评论吗?

解决方案

包级javadoc注释放在名为的文件中package-info.java 在包目录内。它包含注释和包声明:

  / ** 
*提供创建applet所需的类,小程序使用
*与其applet上下文进行通信的类。
*< p>
*小程序框架涉及两个实体:
* applet和applet上下文。一个applet是一个可嵌入的窗口(参见
* {@link java.awt.Panel}类),还有一些额外的方法,applet上下文
*可以用来初始化,启动和停止applet 。
*
* @since 1.0
* @see java.awt
* /
package java.lang.applet;

这里记载的是:


I am using Check-Style, FindBugs, and PMD to validate my Java code. I have fixed almost all the bugs caught by these tools.

I am not able to understand how to write "package comment" which is a bug caught by checkstyle. I have gone through the documentation of Check-Style, but I don't understand it.

Could someone help me in writing a package level comment in Java?

解决方案

Package-level javadoc comments are placed in a file named package-info.java inside the package directory. It contains the comment and a package declaration:

/**
 * Provides the classes necessary to create an applet and the classes an applet uses
 * to communicate with its applet context.
 * <p>
 * The applet framework involves two entities:
 * the applet and the applet context. An applet is an embeddable window (see the
 * {@link java.awt.Panel} class) with a few extra methods that the applet context
 * can use to initialize, start, and stop the applet.
 *
 * @since 1.0
 * @see java.awt
 */
package java.lang.applet;

This is documented here: Package Comment Files

这篇关于如何在Javadoc中添加包级注释?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-19 13:40
查看更多