RFR: JDK-8273244: Improve diagnostic output related to ErroneousTree [v3]

Jonathan Gibbons jjg at openjdk.java.net
Wed Sep 29 03:22:37 UTC 2021


On Mon, 27 Sep 2021 15:48:17 GMT, Pavel Rappo <prappo at openjdk.org> wrote:

>> Jonathan Gibbons has updated the pull request incrementally with one additional commit since the last revision:
>> 
>>   address preliminary review comments
>
> src/jdk.compiler/share/classes/com/sun/tools/javac/tree/DCTree.java line 161:
> 
>> 159:         }
>> 160: 
>> 161:         switch (getKind()) {
> 
> I can see that you changed this switch while moving it from JavacTrees.

Yes.

> src/jdk.compiler/share/classes/jdk/internal/shellsupport/doc/JavadocHelper.java line 498:
> 
>> 496:                             //the newline:
>> 497:                             long endPos = sp.getEndPosition(null, dcTree, tree);
>> 498:                             if (endPos >= offset) {
> 
> What's that about?

Without the change, you can get an exception like `StringIndexOutOfBoundsException` for a bad `endPos`.

I believe there's some underlying weirdness for synthesized HTML comments (i.e. full `<html>...</html>` comments e.g. for `package.html`) that needs to be investigated, but this is in `jshell` code and getting out of scope for this round of work.

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

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


More information about the compiler-dev mailing list