Integrated: 8259050: Error recovery in lexer could be improved

Jan Lahoda jlahoda at openjdk.java.net
Wed Jan 27 11:02:42 UTC 2021


On Tue, 26 Jan 2021 14:00:20 GMT, Jan Lahoda <jlahoda at openjdk.org> wrote:

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

This pull request has now been integrated.

Changeset: b3c8a528
Author:    Jan Lahoda <jlahoda at openjdk.org>
URL:       https://git.openjdk.java.net/jdk/commit/b3c8a528
Stats:     91 lines in 4 files changed: 79 ins; 0 del; 12 mod

8259050: Error recovery in lexer could be improved

Reviewed-by: vromero

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

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


More information about the compiler-dev mailing list