How to get Eclipse to show javadoc for javax annotations

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

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

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

Any ideas? It's hard to believe that Javadoc is not in the annotations!

+3
source share
1 answer

@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. , .

+3

Source: https://habr.com/ru/post/1730823/


All Articles