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

Pavel Rappo prappo at openjdk.java.net
Wed Sep 22 15:12:07 UTC 2021


On Wed, 22 Sep 2021 15:02:01 GMT, Jonathan Gibbons <jjg at openjdk.org> wrote:

>> 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.

In this case, not only the position has changed but also the error description.

Before:

: error: unexpected text
 * {@link //java.lang.Object}
   ^

After:

error: syntax error in reference
 * {@link //java.lang.Object}
          ^

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

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


More information about the compiler-dev mailing list