1 /* 2 * @test /nodymaticcopyright/ 3 * @bug 8206986 4 * @summary Verify reasonable errors are produced when neither ':' nor '->' 5 * is found are the expression of a case 6 * @compile/fail/ref=SwitchArrowBrokenConstant.out -source 12 --enable-preview -Xlint:-preview -XDrawDiagnostics SwitchArrowBrokenConstant.java 7 */ 8 9 public class SwitchArrowBrokenConstant { 10 11 private String likeLambda(int i) { 12 switch (i) { 13 case (a, b) -> {} 14 } 15 return switch (i) { 16 case (a, b) -> {} 17 }; 18 switch (i) { 19 case a; 20 } 21 return switch (i) { 22 case a; 23 }; 24 switch (i) { 25 default ; 26 } 27 return switch (i) { 28 default ; 29 }; 30 } 31 32 }