Javadoc metadata storage time?

Is there a way to access Javadoc information through reflection, how can I save annotations at runtime?

If not, how does Eclipse access javadoc for .jar files?

+4
source share
4 answers

Comments used for Javadoc are never saved in compiled classes (e.g. http://java.sun.com/docs/books/jvms/second_edition/ClassFileFormat-Java5.pdf ). Eclipse can associate Javadoc with the specified jar files, either by extracting it from the jar (if any), by directly linking to the jar file (installed by yourself or by a plugin, for example m2eclipse), or by finding it in the javadoc JRE (directly in the "Installed JREs" )

+2
source

JavaDoc is not available through reflection. Eclipse and other IDE access jar files with JavaDoc for libraries where available. That is, if you use maven, jar files with JavaDocs are usually distributed along with jar files with byte code.

+2
source

In theory, one could have a javadoc doclet that modifies classes from javadoc tags, adding some annotations to the documented elements.

But I don't know any such document (which should also include some types of annotations for use at runtime).

0
source

You can use this tool to access Javadoc at run time through annotations. It works as an annotation processor and generates @Description annotations at compile time. https://github.com/Devexperts/dgen

0
source

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


All Articles