1/* 2 * @test /nodynamiccopyright/ 3 * @bug 4725650 4 * @summary Restrict scope of local classes in switch-block-group 5 * @author gafter 6 * 7 * @compile/fail/ref=SwitchScope.out -XDrawDiagnostics SwitchScope.java 8 */ 9 10public class SwitchScope { 11 public static void main(String[] args) { 12 switch (args.length) { 13 case 0: 14 final int k; 15 k = 12; 16 class Local { 17 int j = k; 18 } 19 case 1: 20 // the scope of a local class does not extend from one 21 // switch case to the next. 22 Object o = new Local(); 23 } 24 } 25} 26