1 /* 2 * @test /nodynamiccopyright/ 3 * @bug 8209400 4 * @summary Allow anonymous classes to be value types 5 * @compile/fail/ref=IllegalByValueTest.out -XDrawDiagnostics -XDdev IllegalByValueTest.java 6 */ 7 8 import java.lang.annotation.ElementType; 9 import java.lang.annotation.Target; 10 import java.util.Comparator; 11 12 public class IllegalByValueTest { 13 14 @Target(ElementType.TYPE_USE) 15 @interface Annot { 16 } 17 18 public static void main(String[] args) { 19 // Error cases. 20 new primitive @Annot primitive Comparable <String>() {}; 21 int [] ia = new primitive int[10]; 22 new primitive String("Hello"); 23 } 24 }