equal
deleted
inserted
replaced
76 |
76 |
77 public static void main(String... argv) { |
77 public static void main(String... argv) { |
78 @Nesting(LOCAL) |
78 @Nesting(LOCAL) |
79 class LocalClass{}; |
79 class LocalClass{}; |
80 |
80 |
81 Object o = new @Nesting(ANONYMOUS) Object() { // An anonymous annotated class |
81 Object o = new /*@Nesting(ANONYMOUS)*/ Object() { // An anonymous annotated class |
82 public String toString() { |
82 public String toString() { |
83 return "I have no name!"; |
83 return "I have no name!"; |
84 } |
84 } |
85 }; |
85 }; |
86 |
86 |
93 TestAnonClassNames.class, |
93 TestAnonClassNames.class, |
94 }; |
94 }; |
95 |
95 |
96 for(Class<?> clazz : classes) { |
96 for(Class<?> clazz : classes) { |
97 String name = clazz.getName(); |
97 String name = clazz.getName(); |
|
98 Nesting anno = clazz.getAnnotation(Nesting.class); |
98 System.out.format("%s is %s%n", |
99 System.out.format("%s is %s%n", |
99 clazz.getName(), |
100 clazz.getName(), |
100 clazz.getAnnotation(Nesting.class).value()); |
101 anno == null ? "(unset/ANONYMOUS)" : anno.value()); |
101 testClassName(name); |
102 testClassName(name); |
102 } |
103 } |
103 } |
104 } |
104 |
105 |
105 /** |
106 /** |
159 System.out.printf("\tSimple name: ''%s''\tQualified Name: ''%s''\tKind ''%s''\tNesting ''%s''%n", |
160 System.out.printf("\tSimple name: ''%s''\tQualified Name: ''%s''\tKind ''%s''\tNesting ''%s''%n", |
160 typeElt.getSimpleName().toString(), |
161 typeElt.getSimpleName().toString(), |
161 typeElt.getQualifiedName().toString(), |
162 typeElt.getQualifiedName().toString(), |
162 typeElt.getKind().toString(), |
163 typeElt.getKind().toString(), |
163 nestingKind.toString()); |
164 nestingKind.toString()); |
164 |
165 Nesting anno = typeElt.getAnnotation(Nesting.class); |
165 if (typeElt.getAnnotation(Nesting.class).value() != nestingKind) { |
166 if ((anno == null ? NestingKind.ANONYMOUS : anno.value()) != nestingKind) { |
166 throw new RuntimeException("Mismatch of expected and reported nesting kind."); |
167 throw new RuntimeException("Mismatch of expected and reported nesting kind."); |
167 } |
168 } |
168 } |
169 } |
169 |
170 |
170 } |
171 } |