#23 JavaStyle javadoc comment error

closed-fixed
Mike Atkinson
None
5
2003-07-24
2002-05-02
Anonymous
No

JavaStyle can erroneously insert parameters into a
JavaDoc description when you comment out the method
underneath the comment. This is because it goes and
searches down for the next available uncommented out
method and uses that method to update the javadoc.

Example. If you have this code snippet:

/**
* Constructor for the AdapterInfo object
*
*/
public AdapterInfo() { }

/**
* Construct an instance of this class with
the given field values.
*
* @param protocolName The name of the
protocol the adapter supports (i.e., FTP).
* @param adapter A reference to the
adapter itself (i.e., this).
* @param isServer True if the adapter
is a server adapter, false if not.
* @param processId Description of the
Parameter
*/
public AdapterInfo(
String protocolName,
AdapterActionListener adapter,
boolean isServer,
int processId)

and then you comment out the constructor at the top,
it changes the JavaDoc of the commented out
constructor as follows:

/**
* Constructor for the AdapterInfo object
*
* @param protocolName Description of the
Parameter
* @param adapter Description of the
Parameter
* @param isServer Description of the
Parameter
* @param processId Description of the
Parameter
*/
//public AdapterInfo() { }

If you then uncomment out the constructor, it removes
the non-existent parameters, restoring the javadoc to
its original state. However, it would be nicer if it
never inserted the non-existent parameter information
in the first place.

Discussion

  • Slava Pestov
    Slava Pestov
    2002-05-18

    • summary: Java --> JavaStyle javadoc comment error
     
  • Dirk Möbius
    Dirk Möbius
    2002-11-23

    • assigned_to: nobody --> dmoebius
     
  • Slava Pestov
    Slava Pestov
    2003-05-29

    • assigned_to: dmoebius --> nobody
    • labels: 102671 -->
    • milestone: 101609 -->
     
  • Brad Mace
    Brad Mace
    2003-06-17

    • assigned_to: nobody --> dmoebius
     
  • Mike Atkinson
    Mike Atkinson
    2003-07-24

    Logged In: YES
    user_id=476481

    Fixed in Version 2.7.01 of JRefactory.

     
  • Mike Atkinson
    Mike Atkinson
    2003-07-24

    • assigned_to: dmoebius --> mikeatkinson
    • status: open --> closed-fixed