Bug 111062 - [javadoc] detect references to invisible members
Summary: [javadoc] detect references to invisible members
Status: RESOLVED WONTFIX
Alias: None
Product: JDT
Classification: Eclipse Project
Component: Core (show other bugs)
Version: 3.2   Edit
Hardware: PC All
: P3 enhancement (vote)
Target Milestone: 3.2 M6   Edit
Assignee: Frederic Fusier CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2005-09-29 10:06 EDT by Tom Hofmann CLA
Modified: 2007-10-01 13:01 EDT (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 Tom Hofmann CLA 2005-09-29 10:06:32 EDT
3.2

Not sure whether this is possible at all, but consider this fragment:

public class X {
  /**
   * API method, see also {@link #bar()}.
   */
  public void foo() {}

  /**
   * Private comment.
   */
  void bar() {}
}


Depending on the javadoc settings used, the reference to the method bar() from
the comment of foo() will be invalid since bar() will not be included in the
documentation. If the user chooses to include package private members in the
javadoc, everything is perfectly valid, however.
Comment 1 Frederic Fusier CLA 2005-09-29 11:17:47 EDT
See also bug 110964
Comment 2 Frederic Fusier CLA 2006-03-30 12:31:19 EST
Even if you generate only at public level, javadoc does not raise any warning on this test case. The link in foo javadoc comment is well created, the only thing is that you cannot access it as it was not generated...
Invisible only means for references inside code and we already have a specific option for that.
Comment 3 Markus Keller CLA 2007-10-01 09:53:26 EDT
The current implementation replicates Javadoc's bug (see also bug 53977), but this wrongly leads people to think their Javadoc is clean while in fact, it still contains dangling references.

See e.g. in attachment 79464 [details] of bug 201426: Javadoc of SearchPattern#validateMatchRule(String, int) refers to private and undocumented #validateCamelCasePattern(String).
Comment 4 Frederic Fusier CLA 2007-10-01 10:28:50 EDT
(In reply to comment #3)
> The current implementation replicates Javadoc's bug (see also bug 53977), but
> this wrongly leads people to think their Javadoc is clean while in fact, it
> still contains dangling references.
> 
> See e.g. in attachment 79464 [details] of bug 201426: Javadoc of
> SearchPattern#validateMatchRule(String, int) refers to private and undocumented
> #validateCamelCasePattern(String).
> 
This is not true. No warning is reported on this reference because Javadoc compiler preference is set to 'Private' visibility on org.eclipse.jdt.core project. If you change the Javadoc compiler level to 'Default' or higher, then you'll get the expected warning "Javadoc: 'default' visibility for malformed doc comments hides  this 'private' reference"
Comment 5 Markus Keller CLA 2007-10-01 13:01:14 EDT
You're right, flagging that reference to a private member of the enclosing type only makes sense if private members are not going to be included in the generated Javadoc.

To find such problems, I guess we would need a second setting besides the current 'Only consider members as visible as' option, e.g. 'Report references with lower visibility than' [Public|Protected|Package|Private]. This new option could then be used as the default in the Javadoc export wizard. Low priority, though.