views:

85

answers:

2

I have a deprecated method in my class:

@Deprecated
public void deprecatedMethod() {
   //do bad things
}

I don't want that method to appear in the javadoc. I know there's an option called -nodeprecated which:

"Prevents the generation of any deprecated API at all in the documentation."

So I'm using this option and it doesn't exclude the method from javadoc. Is it a bug in javadoc or am I using it wrong? What else can I do?

(I'm using eclipse 3.4.2 to produce javadoc)

+3  A: 

You have to include "-nodeprecated" option in the Export to javadoc wizard. Warning: it is a javadoc option, not a VM option.

I've tested it in Eclipse 3.4 and it worked.

Edit: If you only include Deprecated annotation it doesn't work. You have to include @deprecated tag inside method javadoc as well.

I don't know if there's a way to tell javadoc to use @Deprecated anotation (which curiously doesn't have a message parameter to document why is deprecated and what else to use).

Edit: before-1.5 way of deprecate methods

You have to include a @deprecated tag (or indicator or whatever) with the message you want to display to the user in the javadoc after the "deprecated".

/**
  This method sets the property A.
  @see getA
  @author helios
  @deprecated This method is not sync safe, use setAOk instead
 */
public void setA(String value) ...
helios
Really? That's exactly what I did. Still doesn't work...Have you marked your class @Deprecated the same way I did?How did you generate javadoc? Here's how I did:Project->Generate Javadoc->next->next.and there in the extra javadoc options I wrote -nodeprecated.
snakile
Let me try, I've used javadoc @deprecated also :)
helios
That's the thing. I'll update my answer.
helios
OK. What does it mean to "include @deprecated tag inside method javadoc"? How? (and thanks)
snakile
I suspect that javadoc only process what's inside the /** **/ and doesn't look for annotations... I checked the javadoc -help and it doesn't says nothing about annotations. Only the -nodeprecated and the -nodeprecatedlist (don't generate the list of deprecated methods altogether).
helios
A: 

@helios

john is saying that you must include the @deprecated javadoc tag within the javadoc comment block (/** ... */) as he has done above with:

@deprecated This method is not sync safe, use setAOk instead

Add this, then use the -nodeprecated option when running javadoc and the methods will not appear in the generated doc.

dedmorris