Bug 46854 - [DCR] Javadoc configuration setting needs more flexibility
Summary: [DCR] Javadoc configuration setting needs more flexibility
Status: VERIFIED FIXED
Alias: None
Product: JDT
Classification: Eclipse Project
Component: Core (show other bugs)
Version: 3.0   Edit
Hardware: All All
: P3 enhancement (vote)
Target Milestone: 3.0 M6   Edit
Assignee: Frederic Fusier CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2003-11-18 13:08 EST by Marco Qualizza CLA
Modified: 2003-12-16 09:35 EST (History)
1 user (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Marco Qualizza CLA 2003-11-18 13:08:16 EST
There are a number of settings I'd love to set for the javadoc checks in the
compiler settings section, primarily:
   require all methods (regardless of visibility) to have javadocs
   allow multiple @throws per thrown exception

But the current UI doesn't allow for that kind of detail.  Are there any plans
for making the Javadoc checks more configurable?  If not, I'd like to request
more configuration options :-)
Comment 1 Dirk Baeumer CLA 2003-11-21 11:20:52 EST
JDT/Core provides the "real" function.
Comment 2 Philipe Mulet CLA 2003-11-24 07:03:25 EST
Why would you need multiple @throws per thrown exception ? Is it to be able to 
add each scenario behind ?
Comment 3 Marco Qualizza CLA 2003-11-24 09:14:33 EST
I'm not sure I understand your second question, but as to why multiple @throws
per Exception, one example (the pattern I use most frequently) it to have one
@throws for type checks and one @throws for range checks (when a failure in
either will throw, for example, IllegalArgumentException)...
Comment 4 Frederic Fusier CLA 2003-12-01 04:18:29 EST
Marco,

I don't understand your second requirement. May you provide a example?
My assumption is that you want to have this kind of Javadoc:
/**
 * @throws MyException between these range for this value
 * @throws MyException if this parameter has this type
 * @throws MyException ...
 * @throws MySecondException
 */
At my point of view you can write the same using current model:
/**
 * @throws MyException
 *        1) between these range for this value
 *        2) if this parameter has this type
 *        3) ...
 * @throws MySecondException
 */

The model for Javadoc comment assumes that all lines following a line including 
a tag declaration owns to this tag until the next tag declaration (or the end 
of the comment of course).

Otherwise, OK for your first suggestion which can be a possible additional 
option for Javadoc checking...

Comment 5 Marco Qualizza CLA 2003-12-01 09:44:30 EST
Well, I'm not married to the exceptions thing, and your solution works just as
well. :-)  Thanks for the methods -- please extend to also include fields?
Comment 6 Frederic Fusier CLA 2003-12-01 12:32:25 EST
Of course, this would be extended for methods, constructors, fields and types
Comment 7 Marco Qualizza CLA 2003-12-01 14:10:18 EST
Should we consider packages?  Or should I enter another enhancement request for
that?
Comment 8 Frederic Fusier CLA 2003-12-02 09:53:44 EST
If package means that user can set the visibility level from which the javadoc 
checks will be performed, then we can use this bug.

First possibility would be that user had a radio button with four values: 
public, protected, package and private. Then, compiler would check only on 
methods, fields and types which would have a visibility equal or larger than 
the selected one.

Second possibility would be that user has a multi-selection choice with the 
same four values. Then compiler would check methods, fields and  types which  
would have been selected.
Comment 9 Marco Qualizza CLA 2003-12-02 10:13:07 EST
Actually, I was thinking along the lines of package-level javadocs... ie/
package.html.  But, of your two ideas, IMHO, the second one adds unwarranted
flexibility... (Again, this is merely my opinion, but I can't see the value of
selecting "enforce javadocs for package-visible members, but not public members"...
Comment 10 Frederic Fusier CLA 2003-12-08 04:02:33 EST
Current option 'Missing Javadoc tags' will be changed to let user enter level 
of visibility he wants to report this problem instead of having just the choice 
to enable/disable it.

Fix for this bug is ready but we need to synchronize with JDT-UI for release.

See also bug 46976.
Comment 11 Frederic Fusier CLA 2003-12-08 04:09:25 EST
Martin,

The existing compiler option COMPILER_PB_MISSING_JAVADOC will be changed as 
follow:
 * COMPILER / Reporting Missing Javadoc Comment
 *    Specify the level of visibility from which the compiler will signal cases
      where class, interface, method,
 *    constructor or field has no javadoc comment. When set to "never" value,
      the compiler will never complain
 *    about missing javadoc comment.
 *    The severity of the problem is controlled with
      option "org.eclipse.jdt.core.compiler.problem.invalidJavadoc".
 *     - option id:
      "org.eclipse.jdt.core.compiler.problem.missingJavadoc"
 *     - possible values: 
      { "never", "public", "protected", "default", "private" }
 *     - default:           "never"

As we need to be synchronized to release this change, I'll send you a JDT-Core 
jar file in order to have this bug and bug 46976 fixes and prepare 
corresponding change in JDT-UI to be able to display the new compiler options.

I assign the bug to you to follow the work about this. When you'll be ready, 
then please reassign the bug to me and we'll release together at this time...

Thanks
Comment 12 Frederic Fusier CLA 2003-12-09 11:44:40 EST
Marco,

We'll add several options to make compiler error report on javadoc easier to 
control for user.

For packages enhancement, please open a new bug, thanks
Comment 13 Frederic Fusier CLA 2003-12-13 16:27:25 EST
New options have been added for Javadoc problems.
 
Complete definition of these new options is done in JDT-Core release notes: 
http://dev.eclipse.org/viewcvs/index.cgi/%7Echeckout%
7E/org.eclipse.jdt.core/buildnotes_jdt-core.html.

Invalid references, missing tags (bug 47940) or missing comments (this bug and 
bug 47319) problems can be now ignored below a specific visibility level.

Finally, user will also have the possibility to ignore missing tags and missing 
comments on overriding methods, assuming that complete Javadoc comments is done 
in superclass or interface declaration (see bug 46976).
Comment 14 Frederic Fusier CLA 2003-12-13 16:31:45 EST
Complete test cases created for this bug and related ones:
jdt.core.tests.compiler.regression.JavadocTestOptions
Comment 15 Frederic Fusier CLA 2003-12-13 16:33:32 EST
Tests of new Javadoc Preference page was also done using HEAD from jdt-ui.
All JDT-UI regression tests pass.
Comment 16 David Audel CLA 2003-12-16 09:35:08 EST
Verified for 3.0M6