Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Method linking/anchoring in Java

Tags:

java

eclipse

I created several Java methods that indirectly related. Question is, can I create some hyperlink between those methods as reference? I am using Eclipse for Java IDE.

like image 884
KnightCavalry Avatar asked Sep 13 '11 13:09

KnightCavalry


2 Answers

You can use the JavaDoc @see tag:

/**
 * @see MyClass#myMethod()
 */

This generates a hyperlink in your JavaDoc.

like image 62
Adriaan Koster Avatar answered Oct 16 '22 20:10

Adriaan Koster


In Eclipse, code completion also works in comments and can be used to create links. When you start typing the name of a class, hit Ctrl + Space to get a list of matching classes. It will create an @link tag for that class. Adding a # behind the name and repeating the autocompletion shortcut gives you a list of methods of that class. For methods of the same class you are working in, just type # and hit auto completion.

Clicking on a class or method name in the comment while holding Ctrl will let you jump to that class or method, even without the @see or @link tags.

like image 2
kapex Avatar answered Oct 16 '22 22:10

kapex