2010-02-01 22 views
3

我真的很喜欢Eclipse为我使用的各种Java库类弹出Javadoc文档的方式。但是,我也使用JPA和JAXB注释,如@Entity和@XMLType。 Eclipse认识到这些是有效的,因为我可以点击ctrl-space并弹出。我还为javax类获得Javadoc。如何让Eclipse为javax注释显示Javadoc

但是这些注释没有Javadoc ......它只是报告说找不到Javadoc。

我已经下载了javadoc,将它安装在我的系统上并与我的Java6系统库(唯一安装的)中的所有JAR相关联。

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

+0

你弄明白了吗? – Espen 2010-04-26 13:33:01

+1

我终于做到了。进入preferences-> maven并检查工件源和工件javadoc。诀窍了。谢谢! – HDave 2010-04-29 04:27:39

回答

3

@Entity没有标记@Documented注释。

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

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

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

的@Documented注解用的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。然后它会按照你的预期工作。