Javadoc for local variables?

eclipse, java, javadoc, local-variables

Solution

It can be done using `Annotations`.

Create a simple annotation type such as the following:

@Retention(RetentionPolicy.SOURCE)
@Target(ElementType.LOCAL_VARIABLE)
@interface LocalVariableDocumentation {
    String value();
}

And use it on your local variable:

@LocalVariableDocumentation("A very important object!")
Object anImportantObject;

Eclipse will show the annotation in the tooltip.

Problem

Short question: Is it possible to create Javadoc for local variables? (I just want an explanation for my local variable when hovering over it in Eclipse) Thanks for any hint :-)

Original source