@@ -78,6 +78,7 @@ private AnnotationTypeMappings(RepeatableContainers repeatableContainers,
7878
7979 private void addAllMappings (Class <? extends Annotation > annotationType ,
8080 Set <Class <? extends Annotation >> visitedAnnotationTypes ) {
81+
8182 Deque <AnnotationTypeMapping > queue = new ArrayDeque <>();
8283 addIfPossible (queue , null , annotationType , null , false , visitedAnnotationTypes );
8384 while (!queue .isEmpty ()) {
@@ -273,11 +274,19 @@ private static class Cache {
273274 */
274275 AnnotationTypeMappings get (Class <? extends Annotation > annotationType ,
275276 Set <Class <? extends Annotation >> visitedAnnotationTypes ) {
276- return this .mappings .computeIfAbsent (annotationType , key -> createMappings (key , visitedAnnotationTypes ));
277+
278+ AnnotationTypeMappings result = this .mappings .get (annotationType );
279+ if (result != null ) {
280+ return result ;
281+ }
282+ result = createMappings (annotationType , visitedAnnotationTypes );
283+ AnnotationTypeMappings existing = this .mappings .putIfAbsent (annotationType , result );
284+ return (existing != null ? existing : result );
277285 }
278286
279287 private AnnotationTypeMappings createMappings (Class <? extends Annotation > annotationType ,
280288 Set <Class <? extends Annotation >> visitedAnnotationTypes ) {
289+
281290 return new AnnotationTypeMappings (this .repeatableContainers , this .filter , annotationType ,
282291 visitedAnnotationTypes );
283292 }
0 commit comments