RFR: 8259050: Error recovery in lexer could be improved
Jan Lahoda
jlahoda at openjdk.java.net
Tue Jan 26 14:05:51 UTC 2021
Consider code like:
public class BrokenEscape {
private String s = "\uaaa";
}
(note the broken escape). This produces:
$ javac BrokenEscape.java
BrokenEscape.java:2: error: illegal unicode escape
private String s = "\uaaa";
^
BrokenEscape.java:2: error: unclosed string literal
private String s = "\uaaa";
^
2 errors
After this patch, it produces:
$ javac BrokenEscape.java
BrokenEscape.java:2: error: illegal unicode escape
private String s = "\uaaa";
^
1 error
which is the error message that used to be produced in the past.
The patch also improves the AST for source levels where text blocks are not supported, but are in fact present in the source code.
-------------
Commit messages:
- 8259050: Error recovery in lexer could be improved
Changes: https://git.openjdk.java.net/jdk/pull/2239/files
Webrev: https://webrevs.openjdk.java.net/?repo=jdk&pr=2239&range=00
Issue: https://bugs.openjdk.java.net/browse/JDK-8259050
Stats: 91 lines in 4 files changed: 79 ins; 0 del; 12 mod
Patch: https://git.openjdk.java.net/jdk/pull/2239.diff
Fetch: git fetch https://git.openjdk.java.net/jdk pull/2239/head:pull/2239
PR: https://git.openjdk.java.net/jdk/pull/2239
More information about the compiler-dev
mailing list