1 /* 2 * @test /nodynamiccopyright/ 3 * @bug 5009601 4 * @summary enum constructors cannot be declared public or protected 5 * @author Joseph D. Darcy 6 * 7 * @compile/fail/ref=EnumProtectedConstructor.out -XDrawDiagnostics EnumProtectedConstructor.java 8 */ 9 10 enum EnumProtectedConstructor { 11 RED(255, 0, 0), 12 GREEN(0, 255, 0), 13 BLUE(0, 0, 255); 14 15 private int r, g, b; EnumProtectedConstructor(int r, int g, int b)16 protected EnumProtectedConstructor(int r, int g, int b) { 17 this.r = r; 18 this.g = g; 19 this.b = b; 20 } 21 } 22