RFR JDK-8220018: javac crash when compiling try-catch-finally inside switch expression

B. Blaser bsrbnd at gmail.com
Wed Mar 27 18:20:07 UTC 2019


Hi,

Please review the following fix for [1] which has already been
discussed in the corresponding thread [2]:

http://cr.openjdk.java.net/~bsrbnd/jdk8220018/webrev.00/

It includes the variant I suggested to store the switch expression
result in a single temporary variable along with Jan's solution for
switch expressions used as conditions. Note that I had to do a tiny
correction to the latter (see 'code.resolve(value.trueJumps)') to make
the following example succeed:

    public static void test4() {
        if (!switch (0) {
            default -> {
                try {
                    break switch(0) { default -> true; };
                }
                finally {
                    break false;
                }
            }
        }) {
            System.out.println("OK!");
        }
    }

It also includes Jan's test case.

Any feedback is welcome (tier1 is OK).

Thanks,
Bernard

[1] https://bugs.openjdk.java.net/browse/JDK-8220018
[2] http://mail.openjdk.java.net/pipermail/compiler-dev/2019-March/013073.html


More information about the compiler-dev mailing list