views:

1750

answers:

9

is there a good example of a source file containing Javadoc?

I can find lots of good examples of Javadoc on the internet, I would just like to find out the particular syntax used to create them, and assume I can pore through the source of some library somewhere but that seems like a lot of work.

+6  A: 

How about the JDK source code?

butterchicken
that was my obvious thought but I'd have to download the whole big mess. :-(
Jason S
Chances are you already have it, since it comes with the JDK (though it's an installation option).
Michael Borgwardt
+1  A: 

Download the sources of Lucene and see how they do it. They have good JavaDocs.

RichieHindle
+7  A: 

How about the JDK source code, but accessed through a 3rd party like docjar? For example, the Collections source.

That way, there's no big download.

GaryF
aha! thanks! :-)
Jason S
Thats a good answer since collections where written by Josh and Neal.
cherouvim
+1  A: 

I use a small set of documentation patterns:

  • always documenting about thread-safety
  • always documenting immutability
  • javadoc with examples (like Formatter)
  • @Deprecation with WHY and HOW to replace the annotated element
dfa
+3  A: 

The page How to Write Doc Coments for the Javadoc Tool contains a good number of good examples. One section is called Examples of Doc Comments and contains quite a few usages.

Also, the Javadoc FAQ contains some more examples to illustrate the answers.

Jared Oberhaus
+1  A: 

If all your looking for is the syntax, then this may help:

http://java.sun.com/j2se/javadoc/writingdoccomments/[1]

Jesse
thanks, already aware of that though (see my question)
Jason S
A: 

If you install a JDK and choose to install sources too, the src.zip contains the source of ALL the public Java classes. Most of these have pretty good javadoc.

Thorbjørn Ravn Andersen
+1  A: 

Have a look at Spring framework source, it has excellent javadocs

Gaël Marziou