You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@ant.apache.org by Keith Hatton <kh...@axiomsystems.com> on 2002/08/07 18:43:13 UTC

RE: [OT] Task to remove a method from .java file

> >
> >        That approach it´s ok for xml files, but it
> is difficult to
> implement in .java source files, since the
> commentaries are different you
> can use "//" to comment a single line, or "/*"  and
> "*/" to comment in
> multiple lines. and another problem in commenting
> its that you can have
> already set a commentari in the method you want to
> comment out.
> 

You can use java.io.StreamTokenizer to parse your .java files. It's not that difficult to keep track of the '{' and '}' to determine whether you're hitting a method or some other block. The nice thing about this class is that it will handle any comment text for you. So put your comment markers either side of the method declaration and drop any comments within it.

Mind you, I still agree with those who say "just because you can do it, doesn't mean you should ..."

Keith

--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>