Java Solaris Communities Sun Store Join SDN My Profile Why Join?
 
Bug Database
Bug Detail
Quick Lists
Top 25 Bugs
Top 25 RFE's
Recently Closed Bugs
Printable Page Printable Page


Bug Database
Bug ID: 4490068
Votes 0
Synopsis stddoclet: doesn't warn for @return tag on void method
Category doclet:tbd
Reported Against merlin-beta
Release Fixed 1.5(tiger-b28)
State 10-Fix Delivered, bug
Priority: 4-Low
Related Bugs
Submit Date 09-AUG-2001
Description
Fixed.
 xxxxx@xxxxx  2003-10-11




(This goes for all versions, I believe)

When I "javadoc" a class that contains a void method, and my comment for that
method contains a @return tag, I would very much appreciate javadoc to warn me
about the mismatch.

Example:

javadoc the following code:

public class MismatchExample {

  /**
   * Here is a comment. See how it tells you what input this method
   * needs and what objects it returns, although we're dealing with
   * a method that is <i>void</i>, and that takes <i>no</i> input
   * parameters.
   *
   * @param s a mysterious string.
   * @param i a virtual integer.
   *
   * @return An object representing the world as we know it.
   */
  public void mismatch() {
    System.out.println("This method does nothing.");
  }

}

The javadoc tool doesn't complain, and the result you get is a perfectly valid
HTML page describing MismatchExample and its mismatch method. This kind of
mismatching javadoc comments happen every time one changes a method. So I'd
very much like javadoc to say something like this:

WARNING: comment for method mismatch reports more input objects than method
requires.
WARNING: method mismatch is void, but there's a @return tag in it's comment.

...and of course, it would be nice to be able to turn this feature on and off...
(Review ID: 129672) 
======================================================================
Work Around




None.
======================================================================
Evaluation
We've decided to put doc comment checking in DocCheck.  I've requested
Eric:

Does DocCheck test for the absence of @return for methods
that return void?

I'm sure DocCheck does the latter request, to point out
when @param exists for a non-existant parameter.

 xxxxx@xxxxx  2002-03-21

Fixed.
 xxxxx@xxxxx  2003-10-11
Comments
  
  Include a link with my name & email   


PLEASE NOTE: JDK6 is formerly known as Project Mustang