Bug 166436 - [javadoc] Potentially wrong javadoc warning for unexpected duplicate tag @value
Summary: [javadoc] Potentially wrong javadoc warning for unexpected duplicate tag @value
Status: VERIFIED FIXED
Alias: None
Product: JDT
Classification: Eclipse Project
Component: Core (show other bugs)
Version: 3.3   Edit
Hardware: PC Windows XP
: P3 normal (vote)
Target Milestone: 3.3 M4   Edit
Assignee: Frederic Fusier CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2006-11-30 20:43 EST by Olivier Thomann CLA
Modified: 2006-12-12 10:32 EST (History)
1 user (show)

See Also:


Attachments
Proposed patch (12.13 KB, patch)
2006-12-01 13:07 EST, Frederic Fusier CLA
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Olivier Thomann CLA 2006-11-30 20:43:28 EST
Using (v_725), the contents of the type org.eclipse.jdt.internal.ui.text.java.ContentAssistHistory in JDT/UI code reports two javadoc warnings.
I would expect none of them.
Comment 1 Frederic Fusier CLA 2006-12-01 08:59:34 EST
There must be javadoc warnings in this case as @value is wrongly used on a member which is not a static field (this is the only valid syntax when compliance <= 1.4: see bug 153399)...

The problem here is that we shouldn't complain about duplicate tags, they are all unexpected.
Comment 2 Olivier Thomann CLA 2006-12-01 09:26:01 EST
I am talking about this code:
/**
 * Creates a new history, equivalent to
 * <code>ContentAssistHistory({@value #DEFAULT_TRACKED_LHS}, {@value #DEFAULT_TRACKED_RHS})</code>.
 */
public ContentAssistHistory() {
	this(DEFAULT_TRACKED_LHS, DEFAULT_TRACKED_RHS);
}

Both DEFAULT_TRACKED_LHS and DEFAULT_TRACKED_RHS are private static final fields (i.e. constant fields).
I don't know if the @value doesn't work because they are not public, but since the value is inlined it should not matter.
Did I miss something?
Comment 3 Frederic Fusier CLA 2006-12-01 09:38:41 EST
The syntax {@value reference_to_static_field} is only valid since 1.5. Before, the correct syntax for @value is {@value} put in the javadoc comment of the static field. In the case you're talking about, the javadoc is on the constructor => it's not valid and explains why compiler should comply
Comment 4 Dani Megert CLA 2006-12-01 10:36:06 EST
Yeah, but it is inside <code> an hence I would not expect JDT Core to check stuff inside that one. You people are just too smart ;-)
Comment 5 Dani Megert CLA 2006-12-01 10:40:00 EST
Not sure though what the JLS says about that but AFAIK it's pretty vague when it comes to Javadoc, so the buest guess is to check what javadoc.exe does.
Comment 6 Frederic Fusier CLA 2006-12-01 11:27:13 EST
(In reply to comment #4)
> Yeah, but it is inside <code> an hence I would not expect JDT Core to check
> stuff inside that one. You people are just too smart ;-)
> 
Thanks a lot ;-)

(In reply to comment #5)
> Not sure though what the JLS says about that but AFAIK it's pretty vague when
> it comes to Javadoc, so the buest guess is to check what javadoc.exe does.
> 
Even inside <code> tag, javadoc tool 1.4 complain about this syntax:
    warning - Inline tag {@value} should only be used with a constant field.
That was the goal of the bug 153399 fix that JDT compiler warns the same way than javadoc tool on @value tag: SUCCESS :-)
Comment 7 Frederic Fusier CLA 2006-12-01 13:07:26 EST
Created attachment 54909 [details]
Proposed patch
Comment 8 Frederic Fusier CLA 2006-12-01 16:48:34 EST
Released for 3.3 M4 in HEAD stream.
Comment 9 Dani Megert CLA 2006-12-02 10:50:03 EST
I love you guys ;-)
Comment 10 Dani Megert CLA 2006-12-12 04:40:55 EST
Fixed the warnings in the code.
Comment 11 David Audel CLA 2006-12-12 10:32:22 EST
Verified for 3.3M4 with I20061212-0010.