上面的Javadoc评论包裹声明有什么作用?
当我在Eclipse中创建新类并检查“生成评论”时,我会明白:
/**
*
*/
package my_package;
/**
* @author myname
*
*/
public class MyClass {
}
评论上方的评论声明是什么意义?当我生成Javadocs时,它似乎并不包含在任何地方(如果我放在那里)。它只是日食失火,还是我拥有的怪异日食设置,还是在那里是有原因的?
When I create a new class in Eclipse and check "Generate comments", I get this:
/**
*
*/
package my_package;
/**
* @author myname
*
*/
public class MyClass {
}
What's the point of the comment above the package declaration? It doesn't seem to be included anywhere (if I put something there) when I generate javadocs. Is it just Eclipse misfiring, or a weird Eclipse setting I have, or is it there for a reason?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
<
是也 package-level评论放置在名为
package> package-info.java
的文件中,该文件用于生成文档,例如软件包java.time
。尝试在常规源文件中包含软件包级注释似乎是一个错误。 docs state'> docs state'您可以将您的评论放在其中一个以下文件...” 。 Intellij还显示了在常规源文件中放置包级评论时的警告“悬挂式Javadoc评论”。
From Oracle
There are also package-level comments which are placed in a file called
package-info.java
, which are used for generating documentation such as for the packagejava.time
.Trying to include a package-level comment in a regular source file seems like a bug. The docs state "you can place your comments in one of the following files...". IntelliJ also shows the warning "Dangling Javadoc comment" when package-level comments are placed in a regular source file.
对我来说,上面生成的评论是由于偏好设置:
不是我出现的。
此外,如果我编辑
文件
注释,则每当我生成注释时,文件级别注释都不会出现。For me, The comments generated above package are because of preference settings:
If I un-check
Automatically add comments for new methods, types, modules ,packages and files
, it is not appearing for me.Moreover, if I edit
Files
comments, then File level comments are not appearing whenever I generate comments.