Skip to content

Commit ccf82e8

Browse files
committed
Minor improvement to handling of AnnotatedClass, wrt lazy resolution
1 parent 91e41a9 commit ccf82e8

File tree

1 file changed

+7
-6
lines changed

1 file changed

+7
-6
lines changed

src/main/java/com/fasterxml/jackson/databind/introspect/AnnotatedClass.java

+7-6
Original file line numberDiff line numberDiff line change
@@ -299,21 +299,21 @@ public Iterable<AnnotatedField> fields()
299299
*/
300300
private void resolveClassAnnotations()
301301
{
302-
_classAnnotations = new AnnotationMap();
302+
AnnotationMap ca = new AnnotationMap();
303303
// [JACKSON-659] Should skip processing if annotation processing disabled
304304
if (_annotationIntrospector != null) {
305305
// add mix-in annotations first (overrides)
306306
if (_primaryMixIn != null) {
307-
_addClassMixIns(_classAnnotations, _class, _primaryMixIn);
307+
_addClassMixIns(ca, _class, _primaryMixIn);
308308
}
309309
// first, annotations from the class itself:
310-
_addAnnotationsIfNotPresent(_classAnnotations, _class.getDeclaredAnnotations());
310+
_addAnnotationsIfNotPresent(ca, _class.getDeclaredAnnotations());
311311

312312
// and then from super types
313313
for (Class<?> cls : _superTypes) {
314314
// and mix mix-in annotations in-between
315-
_addClassMixIns(_classAnnotations, cls);
316-
_addAnnotationsIfNotPresent(_classAnnotations, cls.getDeclaredAnnotations());
315+
_addClassMixIns(ca, cls);
316+
_addAnnotationsIfNotPresent(ca, cls.getDeclaredAnnotations());
317317
}
318318
/* and finally... any annotations there might be for plain
319319
* old Object.class: separate because for all other purposes
@@ -322,8 +322,9 @@ private void resolveClassAnnotations()
322322
/* 12-Jul-2009, tatu: Should this be done for interfaces too?
323323
* For now, yes, seems useful for some cases, and not harmful for any?
324324
*/
325-
_addClassMixIns(_classAnnotations, Object.class);
325+
_addClassMixIns(ca, Object.class);
326326
}
327+
_classAnnotations = ca;
327328
}
328329

329330
/**

0 commit comments

Comments
 (0)