< prev index next >

test/jdk/java/lang/annotation/typeAnnotations/GetAnnotatedInterfaces.java

Print this page

50     public static void main(String[] args) throws Exception {
51         testReturnsZeroLengthArray();
52 
53         if (failed != 0)
54             throw new RuntimeException("Test failed, check log for details");
55         if (tests != 9)
56             throw new RuntimeException("Not all cases ran, failing");
57     }
58 
59     private static void testReturnsZeroLengthArray() {
60         for (Class<?> toTest : testData) {
61             tests++;
62 
63             AnnotatedType[] res = toTest.getAnnotatedInterfaces();
64 
65             if (res == null) {
66                 failed++;
67                 System.out.println(toTest + ".class.getAnnotatedInterface() returns" +
68                         "'null' should zero length array");
69             } else if (res.length != 0) {






70                 failed++;
71                 System.out.println(toTest + ".class.getAnnotatedInterfaces() returns: "
72                         + Arrays.asList(res) + ", should be a zero length array of AnnotatedType");
73             }
74         }
75     }
76 
77     interface If {}
78 
79     abstract static class Clz {}
80 }

50     public static void main(String[] args) throws Exception {
51         testReturnsZeroLengthArray();
52 
53         if (failed != 0)
54             throw new RuntimeException("Test failed, check log for details");
55         if (tests != 9)
56             throw new RuntimeException("Not all cases ran, failing");
57     }
58 
59     private static void testReturnsZeroLengthArray() {
60         for (Class<?> toTest : testData) {
61             tests++;
62 
63             AnnotatedType[] res = toTest.getAnnotatedInterfaces();
64 
65             if (res == null) {
66                 failed++;
67                 System.out.println(toTest + ".class.getAnnotatedInterface() returns" +
68                         "'null' should zero length array");
69             } else if (res.length != 0) {
70                 // Adjust according to JDK-8237952
71                 if (!toTest.isPrimitive() && !toTest.isArray() && toTest != Object.class) {
72                     assert (res.length == 1);
73                     assert (res[0].getType() == IdentityObject.class);
74                     continue;
75                 }
76                 failed++;
77                 System.out.println(toTest + ".class.getAnnotatedInterfaces() returns: "
78                         + Arrays.asList(res) + ", should be a zero length array of AnnotatedType");
79             }
80         }
81     }
82 
83     interface If {}
84 
85     abstract static class Clz {}
86 }
< prev index next >