RFR: JDK-8279513: jdk/javadoc/doclet/testDocletExample/TestDocletExample.java fails after 8278795

Jonathan Gibbons jjg at openjdk.java.net
Wed May 25 17:14:34 UTC 2022


On Wed, 25 May 2022 17:07:36 GMT, Pavel Rappo <prappo at openjdk.org> wrote:

>> Yes, same reasoning. `SnippetUtils` is broken if we get a null result.
>
>> `SnippetUtils` is broken if we get a null result.
> 
> If it's unconditionally so, which it seems to be, wouldn't it be better to throw something from `SnippetUtils.getSnippetById` instead?

Hmmm, The current spec of `SnippetUtils` is to return `null` if an item cannot be found.  So, it is only broken if the user really expects a non-null result.

I guess it depends if there is enough use case where you might want a null result instead of an exception.

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

PR: https://git.openjdk.java.net/jdk/pull/8796


More information about the compiler-dev mailing list