Class Acme.ConvertComments

java.lang.Object
   |
   +----Acme.ConvertComments

public class ConvertComments
extends Object
Convert Java doc comments from /// style to /** style.

Jef Poskanzer's marvelous Acme Java library is indispensible to many a Java coding effort, but is commented with a non-standard Javadoc style. He provided a Flex file to convert those comments to more standard Javadoc style, but I couldn't get it to compile on many of the systems I work on - so instead, I rewrote it in Java.

Having it as a Java class ensures it will be useable at all times when Java is. Also, as an instantiable class, it should be useable in your programs internally (if you are writing a code editor, or compiler, or pretty-printer, or something - there seem to be quite a few of those sorts of things being written for Java).

It should also fix a few bugs in the existing Flex file:

  • An escaped quote (\" or \') would be considered to end a quoted state, causing all sorts of subsequent trouble
  • The comment indentation would be lost
              /// My method
              //  which does nothing
              public void foo()
     
    would become
              /** My method
              *  which does nothing
         * /                   
              public void foo()
     
    fixed to being
              /** My method 
               *  which does nothing * /                   
              public void foo()
     

    Enjoy. If you like it, you can visit my GeoCities homepage, and tell me as much by signing my guestbook.

    The source code.

    George Ruban, 10-3-97.


    Constructor Index

     o ConvertComments()

    Method Index

     o convert(InputStream, OutputStream)
    Convert Java source code from input stream to output stream.
     o main(String[])
    Read and write Java source code files.

    Constructors

     o ConvertComments
     public ConvertComments()
    

    Methods

     o convert
     public void convert(InputStream i,
                         OutputStream o) throws IOException
    
    Convert Java source code from input stream to output stream.

     o main
     public static void main(String args[]) throws IOException
    
    Read and write Java source code files. With no arguments, reads from System.in, writes to System.out. If given file names overwrites files in place. Pass a -d to start debugging output to System.err. Usage: java Acme.ConvertComments [ -d | File.java ...]


    This page hosted by Get your own Free Home Page

    1