Currently I'm referencing methods in other classes with this Javadoc syntax:
@see {@link com.my.package.Class#method()}
And in what I understand from the documentation this is the correct way to do this. But now to the funny part, or frustrating. When I generate this javadoc I first of all get following error:
warning - Tag @see:illegal character: "123" in "{@link com.my.package.Class#method()}" warning - Tag @see:illegal character: "64" in "{@link com.my.package.Class#method()}" warning - Tag @see: reference not found: {@link com.my.package.Class#method()}
The Generated HTML code of this is:
"," <code>com.my.package.Class#method()}</code> ","
And of course I have no link. Can anyone tell me what's happening, and any hints on how to fix this?
According to the ASCII table characters 123 and 64 for wold represent { and @, so why aren't these characters valid when this syntax is correct according to the documentation?
Javadoc provides the @link inline tag for referencing the members in the Java classes. We can think of the @link tag as similar to the anchor tag in HTML, which is used to link one page to another via hyperlinks. Similar to the anchor tag, the path_to_member is the destination, and the label is the display text.
@see <a href="URL#value">label</a> : Adds a link as defined by URL#value . The URL#value is a relative or absolute URL. The Javadoc tool distinguishes this from other cases by looking for a less-than symbol ( < ) as the first character.
We can use the @see and @link tag multiple times in a class, package, or method. The @see tag declares references that point to an external link, class, or method. The @link tag can also be used multiple times for declaring inline links or in contrast with other block tags.
It is shorthand that tells the java docs to insert a link to the desired place when they are being viewed. For instance when you view the javadocs for whatever method has that inside your IDE you'll be shown a link that will take you to the KeyEvent.
For the Javadoc tag @see
, you don't need to use @link
; Javadoc will create a link for you. Try
@see com.my.package.Class#method()
Here's more info about @see
.
Aside from @see
, a more general way of refering to another class and possibly method of that class is {@link somepackage.SomeClass#someMethod(paramTypes)}
. This has the benefit of being usable in the middle of a javadoc description.
From the javadoc documentation (description of the @link tag):
This tag is very simliar to @see – both require the same references and accept exactly the same syntax for package.class#member and label. The main difference is that {@link} generates an in-line link rather than placing the link in the "See Also" section. Also, the {@link} tag begins and ends with curly braces to separate it from the rest of the in-line text.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With