You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@ant.apache.org by Johan Granstrom <jo...@itec.se> on 2000/06/13 18:51:24 UTC
Simple fix for the javadoc task in ant, related to comments in source files.
Note, I don't have diff on my PC and diff on nada.kth.se does not have the
-u option. Sorry.
Line 567++ in org.apache.tools.ant.taskdefs.Javadoc, inside the inner class
JavaReader, reads (see bottom for full read method):
while (c != -1) {
c = in.read();
if (c == '*') {
c = in.read();
if (c == '/') {
c = read();
break;
}
}
}
This will parse comments ending in an even number of stars and then a slash
incorrectly since the slash never will be seen. For example, in
/**
* A comment.
**/
some.code;
/* An other comment. */
the line some.code; will never be seen.
A simple fix is to replace the code with:
do {
if (c == '*') {
c = in.read();
if (c == '/') {
c = read();
break;
} else if (c == '*') {
continue;
}
}
c = in.read();
} while(c != -1);
The full read() method from
org.apache.tools.ant.taskdefs.Javadoc.JavaReader:
public int read() throws IOException {
int c = in.read();
if (c == '/') {
c = in.read();
if (c == '/') {
while (c != '\n' && c != -1) c = in.read();
} else if (c == '*') {
while (c != -1) {
c = in.read();
if (c == '*') {
c = in.read();
if (c == '/') {
c = read();
break;
}
}
}
}
}
if (c == '"') {
while (c != -1) {
c = in.read();
if (c == '\\') {
c = in.read();
} else if (c == '"') {
c = read();
break;
}
}
}
if (c == '\'') {
c = in.read();
if (c == '\\') c = in.read();
c = in.read();
c = read();
}
return c;
}
Regards,
- Johan Georg Granström