1 /* |
1 /* |
2 * Copyright (c) 2010, 2011, Oracle and/or its affiliates. All rights reserved. |
2 * Copyright (c) 2010, 2013, Oracle and/or its affiliates. All rights reserved. |
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
4 * |
4 * |
5 * This code is free software; you can redistribute it and/or modify it |
5 * This code is free software; you can redistribute it and/or modify it |
6 * under the terms of the GNU General Public License version 2 only, as |
6 * under the terms of the GNU General Public License version 2 only, as |
7 * published by the Free Software Foundation. |
7 * published by the Free Software Foundation. |
94 }; |
94 }; |
95 |
95 |
96 List<String> names = new ArrayList<String>(); |
96 List<String> names = new ArrayList<String>(); |
97 for(Class<?> clazz : classes) { |
97 for(Class<?> clazz : classes) { |
98 String name = clazz.getName(); |
98 String name = clazz.getName(); |
99 Nesting anno = clazz.getAnnotation(Nesting.class); |
|
100 System.out.format("%s is %s%n", |
99 System.out.format("%s is %s%n", |
101 clazz.getName(), |
100 clazz.getName(), |
102 anno == null ? "(unset/ANONYMOUS)" : anno.value()); |
101 clazz.getAnnotation(Nesting.class).value()); |
103 testClassName(name); |
102 testClassName(name); |
104 names.add(name); |
103 names.add(name); |
105 } |
104 } |
106 |
105 |
107 // test all names together |
106 // test all names together |
183 System.out.printf("\tSimple name: ''%s''\tQualified Name: ''%s''\tKind ''%s''\tNesting ''%s''%n", |
183 System.out.printf("\tSimple name: ''%s''\tQualified Name: ''%s''\tKind ''%s''\tNesting ''%s''%n", |
184 typeElt.getSimpleName().toString(), |
184 typeElt.getSimpleName().toString(), |
185 typeElt.getQualifiedName().toString(), |
185 typeElt.getQualifiedName().toString(), |
186 typeElt.getKind().toString(), |
186 typeElt.getKind().toString(), |
187 nestingKind.toString()); |
187 nestingKind.toString()); |
188 Nesting anno = typeElt.getAnnotation(Nesting.class); |
188 |
189 if ((anno == null ? NestingKind.ANONYMOUS : anno.value()) != nestingKind) { |
189 if (typeElt.getAnnotation(Nesting.class).value() != nestingKind) { |
190 throw new RuntimeException("Mismatch of expected and reported nesting kind."); |
190 throw new RuntimeException("Mismatch of expected and reported nesting kind."); |
191 } |
191 } |
192 } |
192 } |
193 |
193 |
194 } |
194 } |