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: 4499911
Votes 0
Synopsis RFE JavaDoc tags @snippet or @code tage to represent example code
Category doclet:tbd
Reported Against 1.3.1
Release Fixed
State 11-Closed, duplicate of 4075480, request for enhancement
Priority: 4-Low
Related Bugs 4075480
Submit Date 05-SEP-2001
Description




Classic VM (build JDK-1.2.2_005, native threads, symcjit

The ability to learn Java is directly proportional to the time it takes to get
from reading and understanding the documentation to get to a working piece of
code. I think it would help the Java community immensely if we could get
developers to easily dump in some sample code demonstrating the method being
documented. Also, examples are like a thousand words, in they tend to shorten
or improve the overall documentation.

My suggestion is to the JavaDoc developers is to include a tag like @snippet or
@code. This tag would serve two purposes. First, it would encourage and remind
developers to include sample code snippets in their JavaDoc. Second, it would
make it easier by formatting that section of JavaDoc as source code
automatically, without the author having to  insert "<code>" html tags (or
whatever other tags it would require) to get the documentation to appear as
mono-space example code (without line wrap). This formatting would continue
until another @ tag was encountered or the end of the JavaDoc section was
encountered.
 
My belief is that more developers would just dump in some sample code showing
how to use a method (or a class) if the process were easier. By creating this
tag type just for sample code, I believe would encourage and expand the use of
JavaDoc especially with source code samples.
(Review ID: 131400) 
======================================================================
Work Around
N/A
Evaluation
We recommend use of @example in the java.sun.com/javadoc/proposed-tags.html
for this purpose.  I would prefer not to automatically surround the text
with <code> and </code>, because we want to encourage users to insert
an explanatory paragraph ahead of the code.

This is a dupe of 4075480.
  xxxxx@xxxxx   2001-09-05
Comments
  
  Include a link with my name & email   


PLEASE NOTE: JDK6 is formerly known as Project Mustang