Bug 53977 - [DCR] [Javadoc] Add a Javadoc option not to report errors on non-visible references
Summary: [DCR] [Javadoc] Add a Javadoc option not to report errors on non-visible refe...
Status: VERIFIED FIXED
Alias: None
Product: JDT
Classification: Eclipse Project
Component: Core (show other bugs)
Version: 3.0   Edit
Hardware: PC Windows XP
: P3 enhancement (vote)
Target Milestone: 3.1 M3   Edit
Assignee: Frederic Fusier CLA
QA Contact:
URL:
Whiteboard:
Keywords:
: 60571 75068 84683 (view as bug list)
Depends on:
Blocks: 217891
  Show dependency tree
 
Reported: 2004-03-06 14:44 EST by Richard Davies CLA
Modified: 2008-02-05 14:14 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 Richard Davies CLA 2004-03-06 14:44:30 EST
In Preferences/Java/Compiler/Javadoc, I have set "Malformed Javadoc comments" to
true. When I insert a {@link ClassName#methodName()} in the javadoc of one of my
classes, and "methodName()" is protected, it triggers the warning:

Javadoc: the method methodName()  from the type ClassName is not visible

Which is true, but there again, creating a javadoc reference to a protected
method in another class is not like calling it; I feel it's probably a fairly
legitimate thing to do most of the time and also causes no complaints from
javadoc when it is run (generating javadoc against public and protected members
which is fairly normal too). Is it possible to add an option to disable the
warning for this case while keeping warnings for other types of malformed comments?

My specific example if your interested is below. The protected method in
question is Visitor.traverse(ParentClass).

    /**
     * Calls {@link Visitor#visit(ThisClass)}. Note that {@link Visitor} can be
    * subclassed to provide custom traversals. If the traversal of a {@link
ParentClass}
    * is customized, the overridden method {@link Visitor#traverse(ParentClass)}
    * would call this method only if it wants to traverse <code>ThisClass</code>.
     *
     * @param visitor the {@link Visitor}.
     */
    public void accept(Visitor visitor) {
       visitor.visit(this);
    }
Comment 1 Frederic Fusier CLA 2004-03-24 16:35:07 EST
This is a requirement for a new option, not a bug.
Comment 2 Frederic Fusier CLA 2004-05-09 11:51:29 EDT
*** Bug 60571 has been marked as a duplicate of this bug. ***
Comment 3 Philipe Mulet CLA 2004-05-10 05:57:21 EDT
Post 3.0
Comment 4 Martin Aeschlimann CLA 2004-05-10 08:38:08 EDT
I think this is a bug, not a feature request.
The fact that a reference is non-visible in code does not apply for Javadoc 
references.
To fix it, I don't think adding a new option is the way to go, simply do not 
report that warning.
I would suggest to have that in 3.0 as otherwise I can't get my code warning-
free what lowers the usability of the Javadoc compiler warnings.
Comment 5 Philipe Mulet CLA 2004-05-10 09:47:02 EDT
I disagree. We treat Javadoc exactly as we treat source code. Visibility is 
enforced, and I suspect the extra warnings you can't get rid of are not in 
real API javadoc. If so, these would likely be inconsistent since targeting 
entities which aren't part of the javadoc in the end.

This is a useful warning. We may tweak it some more post 3.0.
Comment 6 Martin Aeschlimann CLA 2004-05-10 10:07:28 EDT
Try my example in bug 60571. Generate documentation using javadoc.exe and you 
get (with no warning or error) the documentation containing a link to a method 
that I couldn't call in my code due to visibility restrictions, but that 
Javadoc obviously still allows my to refer to in my documentation.

The Javadoc tool is setting the rules here, we shouldn't invent our own.

Note that there might be somthing related:
We can say to only generate documentation for public members. In that case it 
would make sense to warn on all references that point to protected or less 
visible members. This is not the problem here. Here I configured to document 
all classes. Maybe that's what you had in mind, but then the current 
implementation has a bug.

Comment 7 Frederic Fusier CLA 2004-09-27 06:52:28 EDT
*** Bug 75068 has been marked as a duplicate of this bug. ***
Comment 8 Frederic Fusier CLA 2004-10-06 07:52:54 EDT
Reconsider for 3.1
Comment 9 Frederic Fusier CLA 2004-10-18 14:42:19 EDT
Fixed.

New compiler option has been added to address this issue:
 * COMPILER / Reporting Invalid Javadoc Tags with Not Visible References
 *    Specify whether the compiler will report non-visible references used in
Javadoc tags.
 *    <br>Note that this diagnosis can be enabled based on the visibility of the
construct associated with the Javadoc;
 *    also see the setting
"org.eclipse.jdt.core.compiler.problem.invalidJavadocTagsVisibility".
 *     - option id:        
"org.eclipse.jdt.core.compiler.problem.invalidJavadocTagsNotVisibleRef"
 *     - possible values:   { "enabled", "disabled" }
 *     - default:           "enabled"
 * 

See also bug 75701.

[jdt-core-internal]
Test cases added in JavadocTestOptions.
Comment 10 David Audel CLA 2004-11-03 07:24:19 EST
Verified for 3.1M3 with build I20041102
Comment 11 Frederic Fusier CLA 2005-03-16 12:14:03 EST
*** Bug 84683 has been marked as a duplicate of this bug. ***