test/langtools/tools/javac/switchextra/SwitchArrowBrokenConstant.java
author darcy
Thu, 21 Feb 2019 10:29:16 -0800
changeset 53878 4584d0331318
parent 53023 6879069d9d94
child 59021 cfc7bb9a5a92
permissions -rw-r--r--
8219254: Update explicit uses of latest source/target in langtools tests to a property 8219256: Update javac diags tests to use properties Reviewed-by: jjg, jlahoda, darcy, iignatyev Contributed-by: joe.darcy@oracle.com, jonathan.gibbons@oracle.com

/*
 * @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 -source ${jdk.version} --enable-preview -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 ;
        };
    }

}