RFR: 8312204: unexpected else with statement causes compiler crash [v2]

Jan Lahoda jlahoda at openjdk.org
Tue Aug 8 09:33:56 UTC 2023

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

Jan Lahoda has updated the pull request incrementally with one additional commit since the last revision:

  Update test/langtools/tools/javac/parser/JavacParserTest.java
  Co-authored-by: Andrey Turbanov <turbanoff at gmail.com>


  - all: https://git.openjdk.org/jdk/pull/15086/files
  - new: https://git.openjdk.org/jdk/pull/15086/files/a2c898b4..723c1577

 - full: https://webrevs.openjdk.org/?repo=jdk&pr=15086&range=01
 - incr: https://webrevs.openjdk.org/?repo=jdk&pr=15086&range=00-01

  Stats: 1 line in 1 file changed: 0 ins; 0 del; 1 mod
  Patch: https://git.openjdk.org/jdk/pull/15086.diff
  Fetch: git fetch https://git.openjdk.org/jdk.git pull/15086/head:pull/15086

PR: https://git.openjdk.org/jdk/pull/15086

More information about the compiler-dev mailing list