我真的很喜欢 Eclipse 为我使用的各种 Java 库类提供弹出式 Javadoc 文档的方式。不过,我也使用 JPA 和 JAXB 注释,例如 @Entity 和 @XMLType。 Eclipse 认为这些是有效的,因为我可以按 ctrl-space 并且它们会弹出。我还获得了 javax 类的 Javadoc。
但是这些注释没有 Javadoc...它只是报告找不到 Javadoc。
我已经下载了 javadoc,将其安装在我的系统上,并与我的 Java6 系统库(唯一安装的一个)中的所有 JAR 相关联。
有任何想法吗?很难相信没有关于注释的 Javadoc!
@Entity 未使用 @Documented 注释进行标记。
@Target(TYPE)
@Retention(RUNTIME)
public @interface Entity {
如果您尝试使用 @javax.Inject 注释,您应该会看到 JavaDoc,因为它标有 @Documented。
@Target({ METHOD, CONSTRUCTOR, FIELD })
@Retention(RUNTIME)
@Documented
public @interface Inject {}
JavaDoc 的 @Documented 注释:
/**
* Indicates that annotations with a type are to be documented by javadoc
* and similar tools by default. This type should be used to annotate the
* declarations of types whose annotations affect the use of annotated
* elements by their clients. If a type declaration is annotated with
* Documented, its annotations become part of the public API
* of the annotated elements.
*
* @author Joshua Bloch
* @version 1.6, 11/17/05
* @since 1.5
*/
@Documented
@Retention(RetentionPolicy.RUNTIME)
@Target(ElementType.ANNOTATION_TYPE)
public @interface Documented {
}
解决方案是导入 Java 源代码而不是 JavaDoc。然后它将按您的预期工作。
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)