Bug 76324 - [Javadoc] Wrongly reports invalid link format in @see and @link
Summary: [Javadoc] Wrongly reports invalid link format in @see and @link
Status: VERIFIED FIXED
Alias: None
Product: JDT
Classification: Eclipse Project
Component: Core (show other bugs)
Version: 3.0.1   Edit
Hardware: PC Windows XP
: P3 normal (vote)
Target Milestone: 3.1 M3   Edit
Assignee: Frederic Fusier CLA
QA Contact:
URL:
Whiteboard:
Keywords:
: 76460 (view as bug list)
Depends on:
Blocks:
 
Reported: 2004-10-14 18:57 EDT by Jürgen Failenschmid CLA
Modified: 2004-11-03 09:20 EST (History)
2 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Jürgen Failenschmid CLA 2004-10-14 18:57:49 EDT
There is nothing wrong with the sample class comment (javadoc generates the 
correct HTML without any warning or error):

/**
 * Subclasses perform GUI-related work in a dedicated thread. For instructions
 * on using this class, see
 * {@link <a 
href="http://java.sun.com/docs/books/tutorial/uiswing/misc/threads.html"> 
Swing tutorial </a>}
 * 
 * @see <a
 *      
href="http://gee.cs.oswego.edu/dl/classes/EDU/oswego/cs/dl/util/concurrent/intr
o.html">
 *      EDU.oswego.cs.dl.util.concurrent </a>
 * @see <a
 *      
href="http://java.sun.com/j2se/1.5.0/docs/api/java/util/concurrent/package-
summary.html">
 *      JDK 5.0 </a>
 * @author {@link <a href="http://gee.cs.oswego.edu/dl">Doug Lea</a>}
 * @author {@link <a href="http://home.pacbell.net/jfai">Jürgen 
Failenschmid</a>}
 */

Eclipse flags each line containing a href either with "Javadoc: Invalid URL 
link format" or "Javadoc: Invalid reference".
Comment 1 Frederic Fusier CLA 2004-10-15 06:01:41 EDT
According to Javadoc spec 1.4, inline tag @link should be followed only with a
reference then a label. String and URL link references are only specified for
@see tag.

However, if Javadoc can generate it without warning, I agree that we should not
raise any for this kind of syntax...
Comment 2 Frederic Fusier CLA 2004-10-15 08:00:58 EDT
Note that warnings in @see tags are due to the fact that <a> tag is declared on
several lines. Again, as Javadoc accept this kind of syntax, we should not raise
warnings on it...
Comment 3 Jürgen Failenschmid CLA 2004-10-15 15:38:51 EDT
The multi-line "<a href=" was created using the automatic formatter. However, 
Eclipse complains just the same if the link is on a single line, e.g.:

{@link <a 
href="http://www.seas.ucla.edu/java3d/com/sun/j3d/utils/applet/JMainFrame.html"
> JMainFrame </a>}

Both cases are accepted by Javadoc.
Comment 4 Frederic Fusier CLA 2004-10-16 06:20:36 EDT
As I said in comment 1, for @link inline tag, problem comes from a strict
implementation of the Javadoc spec.
Comment 2 was to say that multiline issue is only for @see tag...
Comment 5 Frederic Fusier CLA 2004-10-18 07:50:12 EDT
*** Bug 76460 has been marked as a duplicate of this bug. ***
Comment 6 Frederic Fusier CLA 2004-10-18 14:43:16 EDT
Fixed.

Now string and URL link references are allowed for inline tags
* {@link "string"}
* {@link <a href="URL">text</a>}
Note that it's still not allowed to add text after these kind of references.
So, following syntaxes will be warned as invalid:
* {@link "string"unexpected text}
* {@link <a href="URL">text</a>unexpected text}

It's also now possible to write an URL link reference tag on several line for
@see tag.

[jdt-core-internal]
Changes done in AbstractCommentParser: parseHref() and parseReference()
Test cases added in JavadocTestMixed
Comment 7 Jürgen Failenschmid CLA 2004-10-18 14:50:11 EDT
Please also verify that the fix is compatible with the default automatic 
formatter: use the examples that I supplied originally. Automatically format 
the code (CTL-SHF-F). The URL reference will be split into several lines.
Comment 8 Frederic Fusier CLA 2004-10-19 05:18:26 EDT
I've already made this verification...
This explains the sentence I wrote in comment 6:
"It's also now possible to write an URL link reference tag on several line for
@see tag."

Moreover, the Javadoc in your initial example was already formatted... Usually,
before saying fixed to a bug, we verify that our change effectively fixes the
example given in the bug...

Saying that, from this fix, the only thing user should not write on several line
for URL link reference in @see tag is the end of the tag: </a>.
That means that following URL link reference:
 * @see <a
 *           href="http://...html">
 *           EDU.oswego.cs.dl.util.concurrent
 *           <
 *           /a>
will be flagged as invalid although Javadoc does not warn user during generation.
We decide not to have same behavior than Javadoc in this peculiar case because
with this syntax, Javadoc automatically add closing tag </a> and you get an
extra "</a>" in the text... which is obviously not correct.
Comment 9 David Audel CLA 2004-11-03 09:20:10 EST
Verified for 3.1M3 with build I20041102