test/langtools/tools/javac/switchextra/SwitchArrowBrokenConstant.java
author jlahoda
Tue, 12 Nov 2019 06:32:13 +0000
changeset 59021 cfc7bb9a5a92
parent 53878 4584d0331318
permissions -rw-r--r--
8232684: Make switch expressions final Reviewed-by: alanb, mcimadamore, kvn

/*
 * @test /nodymaticcopyright/
 * @bug 8206986
 * @summary Verify reasonable errors are produced when neither ':' nor '->'
 *          is found are the expression of a case
 * @compile/fail/ref=SwitchArrowBrokenConstant.out -Xlint:-preview -XDrawDiagnostics SwitchArrowBrokenConstant.java
 */

public class SwitchArrowBrokenConstant {

    private String likeLambda(int i) {
        switch (i) {
            case (a, b) -> {}
        }
        return switch (i) {
            case (a, b) -> {}
        };
        switch (i) {
            case a;
        }
        return switch (i) {
            case a;
        };
        switch (i) {
            default ;
        }
        return switch (i) {
            default ;
        };
    }

}