Java Reference
In-Depth Information
// Questionable use of Unicode escape in Javadoc comment
/**
* This method calls itself recursively, causing a
* <tt>StackOverflowError</tt> to be thrown.
* The algorithm is due to Peter von der Ah\u00E9.
*/
This technique represents an unnecessary use of Unicode escapes. Use HTML entity escapes
instead of Unicode escapes in Javadoc comments :
/**
* This method calls itself recursively, causing a
* <tt>StackOverflowError</tt> to be thrown.
* The algorithm is due to Peter von der Ahé.
*/
Either of the preceding comments should cause the name to appear in the documentation as "Peter
von der Ahé," but the latter comment is also understandable in the source file.
In case you were wondering, the comment in this puzzle was derived from an actual bug report. The
program was machine generated, which made it difficult to track the problem down to its source, an
IDL-to-Java compiler. To avoid placing other programmers in this position, tools must not put
Windows filenames into comments in generated Java source files without first processing them
to eliminate backslashes.
In summary, ensure that the characters \u do not occur outside the context of a valid Unicode
escape, even in comments. Be particularly wary of this problem in machine-generated code.
 
 
Search WWH ::




Custom Search