RFR: 8252882: Clean up jdk.javadoc and the related parts of jdk.compiler

Pavel Rappo prappo at openjdk.java.net
Mon Sep 14 14:11:27 UTC 2020


On Mon, 14 Sep 2020 13:47:28 GMT, Vicente Romero <vromero at openjdk.org> wrote:

>> Yet another cleanup change that has accumulated during my work on `DocCommentParser` and other javadoc-related areas of
>> compiler.
>
> src/jdk.compiler/share/classes/com/sun/tools/javac/parser/DocCommentParser.java line 290:
> 
>> 288:
>> 289:     protected void inlineTag(ListBuffer<DCTree> list) {
>> 290:         assert buf[bp] == '{' : buf[bp];
> 
> not sure that this is what you want to do. We usually use com.sun.tools.javac.util.Assert for this as they can't be
> skipped if the code is not executed with assertions off. Same for similar changes in this patch

I was hoping to use the `assert` facility for the purposes it was designed for. That particular occurrence of `assert`
as well as others in this pull request are about asserting that **our code** is being correct rather than input being
correct. The invariants those assertions establish MUST hold regardless of the input.

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

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


More information about the javadoc-dev mailing list