如何获得Eclipse来显示的javax标注的Javadoc [英] How to get Eclipse to show Javadoc for javax annotations

查看:150
本文介绍了如何获得Eclipse来显示的javax标注的Javadoc的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我真的很喜欢这样的Eclipse对我使用各种Java类库弹出Javadoc文档。不过,我也使用JPA和JAXB注释,如@Entity和@XMLType。 Eclipse的识别这些作为有效的,因为我可以按Ctrl空间,他们弹出。我也得到Javadoc文档的javax类。

I really like the way Eclipse has pop-up Javadoc documentation for the various Java library classes I use. However, I also use JPA and JAXB annotations such as @Entity and @XMLType. Eclipse recognises these as valid because I can hit ctrl-space and they pop-up. I also get Javadoc for javax classes.

但没有Javadoc文档这些注解......它只是报道说Javadoc中找不到。

But there is no Javadoc for these annotations...it just reports that Javadoc could not be found.

我已经下载的Javadoc,安装了它在我的系统,并与我的Java6系统库中的所有JAR文件(只有一个安装)相关联。

I've downloaded the javadoc, installed it on my system and associated with all the JARs in my Java6 system library (the only one installed).

任何想法?很难相信这是在没有注释的Javadoc!

Any ideas? Hard to believe there is no Javadoc on annotations!

推荐答案

@Entity没有打上@Documented注释。

@Entity isn't marked with the @Documented annotation.

@Target(TYPE) 
@Retention(RUNTIME)
public @interface Entity {

如果您使用@ javax.Inject注解尝试相反,你应该看到的JavaDoc,因为它打上@Documented。

If you try with the @javax.Inject annotation instead, you should see the JavaDoc, since it's marked with @Documented.

@Target({ METHOD, CONSTRUCTOR, FIELD })
@Retention(RUNTIME)
@Documented
public @interface Inject {}

该@Documented批注与JavaDoc的:

The @Documented annotation with JavaDoc:

/**
 * 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。然后,当你希望它会工作。

A solution is to import the Java source instead of the JavaDoc. Then it will work as you expect.

这篇关于如何获得Eclipse来显示的javax标注的Javadoc的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆