RFR: 8312204: unexpected else with statement causes compiler crash

Vicente Romero vromero at openjdk.org
Mon Aug 7 15:54:29 UTC 2023


On Mon, 31 Jul 2023 08:43:28 GMT, Jan Lahoda <jlahoda at openjdk.org> wrote:

> Compiling (erroneous) code like:
> 
> void main() {
>     else ;
> }
> 
> 
> Leads to:
> 
> $ javac --enable-preview -source 22 /tmp/Test.java 
> An exception has occurred in the compiler (22-internal). Please file a bug against the Java compiler via the Java bug reporting page (https://bugreport.java.com) after checking the Bug Database (https://bugs.java.com) for duplicates. Include your program, the following diagnostic, and the parameters passed to the Java compiler in your report. Thank you.
> java.lang.AssertionError
>         at jdk.compiler/com.sun.tools.javac.parser.VirtualParser$VirtualScanner.errPos(VirtualParser.java:151)
>         at jdk.compiler/com.sun.tools.javac.parser.JavacParser.doRecover(JavacParser.java:3122)
> ...
> 
> 
> The proposed solution is to implement the two corresponding `errPos` methods for `VirtualScanner`.

looks good

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

Marked as reviewed by vromero (Reviewer).

PR Review: https://git.openjdk.org/jdk/pull/15086#pullrequestreview-1565669717


More information about the compiler-dev mailing list