Bug 73479 - [Javadoc] Improve error message for invalid link in @see tags
Summary: [Javadoc] Improve error message for invalid link in @see tags
Status: VERIFIED FIXED
Alias: None
Product: JDT
Classification: Eclipse Project
Component: Core (show other bugs)
Version: 3.0   Edit
Hardware: PC Windows XP
: P3 normal (vote)
Target Milestone: 3.1 M2   Edit
Assignee: Frederic Fusier CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2004-09-08 14:02 EDT by Gary Gregory CLA
Modified: 2004-09-23 10:33 EDT (History)
0 users

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Gary Gregory CLA 2004-09-08 14:02:35 EDT
Version 3.1.M1. 
The Javadoc:

    /**
     * Declares the Serial Version Uid.
     * 
     * @see <a
href="http://c2.com/cgi/wiki?AlwaysDeclareSerialVersionUid">Always Declare
Serial Version Uid<a>
     */
    private static final long serialVersionUID = 1L;

Gives me the warning:

Severity	Description	Resource	In Folder	Location	Creation Time
1	Javadoc: Invalid URL link format	DecoderException.java	Apache Jakarta
Commons/codec/src/java/org/apache/commons/codec	line 30	September 8, 2004
10:45:30 AM

Which I do not think should be considered a warning since Sun's Javadoc 1.4.2_05
is happy with it and produces the expected HTML.
Comment 1 Frederic Fusier CLA 2004-09-09 09:15:51 EDT
However, your reference is invalid: it should end with </a> (you missed the '/')...
So, compiler is just a little bit more informative than Javadoc... If you look
at generated html, you'll see that Javadoc automatically fixes your mistake... 
Compiler can't do that, so it only signals the mistake.
Comment 2 Gary Gregory CLA 2004-09-09 12:37:24 EDT
Doh! Thank you.
Comment 3 Gary Gregory CLA 2004-09-09 12:38:13 EDT
A better message would be nice of course ;-)
Comment 4 Frederic Fusier CLA 2004-09-09 12:43:34 EDT
I agree but we want to avoid too many different error messages. Perhaps a better
positionning of the underlining would have been helpful...
I'll have a look on that for 3.1
Comment 5 Gary Gregory CLA 2004-09-09 12:48:40 EDT
Now that I think about it, the message is misleading. There is nothing wrong in
this case with the "URL link format"
("http://c2.com/cgi/wiki?AlwaysDeclareSerialVersionUid") which is contained in
the href attribute. What is wrong is the (anchor) tag.
Comment 6 Frederic Fusier CLA 2004-09-09 12:59:17 EDT
You're right => I reopen the bug to fix in in 3.1
Comment 7 Frederic Fusier CLA 2004-09-10 05:55:12 EDT
In this case, I propose that only final <a> was underlined by compiler.
Also, "Invalid URL link format" error message would be replace by:
"Malformed link reference".
Comment 8 Frederic Fusier CLA 2004-09-13 07:25:57 EDT
Fixed.

As said in previous comment, only invalid <a> is now underlined in this peculiar
case. Error message has been modified for all invalid syntax in link reference
of @see tag: "Malformed link reference".
Note that in following invalid syntax:
	/**
	 * @see <a href="...">Valid link</a> Unexpected text...
	 */
	public int m() {
compiler will now only emphasize the wrong unexpected text after valid link
reference with new error message: "Unexpected text".

[jdt-core-internal]
Changes done in org.eclipse.jdt.internal.compiler.problem.message.properties,
ProblemReporter, IProblem to modify and add error messages.
Also modify AbstractCommentParser parseHref() and parserReference() methods.
No test cases added as current ones already verify these messages and syntaxes
=> changes done in all JavadocTest* classes to take into account these new messages
Comment 9 David Audel CLA 2004-09-23 10:33:16 EDT
Verified in I200409240100.