1 /* 2 * @test /nodynamiccopyright/ 3 * @bug 8237067 4 * @summary Check that .default is not allowed in previous versions. 5 * @compile/fail/ref=CheckFeatureGate2.out --release=13 -XDrawDiagnostics CheckFeatureGate2.java 6 */ 7 8 public class CheckFeatureGate2 { 9 10 static <T> void checkDefaultT(Class<T> clazz) throws Exception { 11 while (T.default != null) 12 throw new AssertionError("Generic object should default to null"); 13 } 14 15 public static void main(String[] args) throws Exception { 16 int a = int.default; 17 String s = String.default; 18 int[] ia = int[].default; 19 checkDefaultT(Object.class); 20 } 21 }