RFR: JDK-8257925 enable more support for nested inline tags [v2]

Jonathan Gibbons jjg at openjdk.java.net
Thu Feb 18 18:53:41 UTC 2021

On Thu, 18 Feb 2021 18:47:16 GMT, Jonathan Gibbons <jjg at openjdk.org> wrote:

>> src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/HtmlDocletWriter.java line 1082:
>>> 1080:                     default -> {
>>> 1081:                         assert false;
>>> 1082:                         return HtmlTree.EMPTY;
>> What is the reason to `assert false` here and in other places instead of, say, always throw a RuntimeException?
> This is the general discussion about the use of `assert`, and whether it is better to throw an exception in production code, or "carry on regardless". I wish Java had a should-not-happen statement or at least a ShoudNotHappen exception.

In this case, `IllegalStateException` is a reasonable alternative


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

More information about the compiler-dev mailing list