On Tue, 16 Jan 2024 02:17:10 GMT, Vladimir Petko <vpe...@openjdk.org> wrote:

> '--ignore-source-errors' allows generating Javadoc for the packages that 
> contain compilation errors. 
> 
> jdk.javadoc.internal.doclets.toolkit.util.ClassTree generates a type 
> hierarchy for javadoc that may include error types such as 
> 
> class Foo extends Bar {
> }
> ``` 
> where Bar is undefined. 
> 
> The user still wants to generate documentation for Foo and have Bar as a text 
> label. 
> 
> For the unknown class Bar it is impossible to detect the enclosing class/file 
> and javadoc crashes with exception. 
> 
> This PR returns Kind.OTHER for the error types, avoiding the javadoc crash.

test/langtools/jdk/javadoc/doclet/testClassTree/TestClassTree.java line 66:

> 64:         <li class="circle">badpkg.<a href="ChildClass.html" 
> class="type-name-link" \
> 65:         title="class in badpkg">ChildClass</a> (implements 
> java.lang.Iterable&lt;T&gt;)</li>
> 66:         """);

arguments, like this text block, should be indented.

In general, if you're using an IDE that can reformat fragments of code, like a 
method call, it should be enough/OK to use the IDE reformat calls like this.

test/langtools/jdk/javadoc/doclet/testClassTree/badpkg/ChildClass.java line 1:

> 1: /*

These days, the preferred style is to write small files on the fly during the 
test.  That way, the test class is better co-located with the the code that 
uses it, and as a secondary benefit, you do not need to include a full legal 
header that tends to overwhelm the few lines of interest.

Look in other tests for the use of `tb.writeJavaFiles` which make it easy to 
write a text block containing code to a test-specific directory.

-------------

PR Review Comment: https://git.openjdk.org/jdk/pull/17435#discussion_r1453879301
PR Review Comment: https://git.openjdk.org/jdk/pull/17435#discussion_r1453882997

Reply via email to