RFR: JDK-8273244: Improve diagnostic output related to ErroneousTree [v2]
Jonathan Gibbons
jjg at openjdk.java.net
Wed Sep 22 15:05:09 UTC 2021
On Wed, 22 Sep 2021 12:40:50 GMT, Pavel Rappo <prappo at openjdk.org> wrote:
>> Jonathan Gibbons has updated the pull request incrementally with one additional commit since the last revision:
>>
>> revert unrelated debug edit
>
> src/jdk.compiler/share/classes/com/sun/tools/javac/parser/ReferenceParser.java line 124:
>
>> 122: moduleName = switch (slash) {
>> 123: case -1 -> null;
>> 124: case 0 -> throw new ParseException(0, "dc.ref.syntax.error");
>
> There's a slight change in error output. Although it is likely insignificant, I felt I should note it. For example, compare the error output for `{@link //java.lang.Object}`.
Yes, there were some minor changes to a few (3?) tests because of this work. because of the enhanced precision of the positions.
> src/jdk.compiler/share/classes/com/sun/tools/javac/tree/DCTree.java line 161:
>
>> 159: }
>> 160:
>> 161: switch (getKind()) {
>
> This switch might become even better after "Pattern Matching for switch" has been integrated (currently in preview, JEP 406).
Noted. I go back and forth between switch and methods, but JEP 406 would improve the switch.
> src/jdk.compiler/share/classes/com/sun/tools/javac/tree/DCTree.java line 265:
>
>> 263: * {@return a diagnostic position based on the positions in a comment}
>> 264: *
>> 265: * The positions are lazily converted to file-based positions as needed.
>
> "lazily" somewhat duplicates "as needed", no?
Noted
-------------
PR: https://git.openjdk.java.net/jdk/pull/5510
More information about the compiler-dev
mailing list