@@ -76,6 +76,7 @@ private AnnotationTypeMappings(RepeatableContainers repeatableContainers,
7676
7777 private void addAllMappings (Class <? extends Annotation > annotationType ,
7878 Set <Class <? extends Annotation >> visitedAnnotationTypes ) {
79+
7980 Deque <AnnotationTypeMapping > queue = new ArrayDeque <>();
8081 addIfPossible (queue , null , annotationType , null , visitedAnnotationTypes );
8182 while (!queue .isEmpty ()) {
@@ -270,11 +271,19 @@ private static class Cache {
270271 */
271272 AnnotationTypeMappings get (Class <? extends Annotation > annotationType ,
272273 Set <Class <? extends Annotation >> visitedAnnotationTypes ) {
273- return this .mappings .computeIfAbsent (annotationType , key -> createMappings (key , visitedAnnotationTypes ));
274+
275+ AnnotationTypeMappings result = this .mappings .get (annotationType );
276+ if (result != null ) {
277+ return result ;
278+ }
279+ result = createMappings (annotationType , visitedAnnotationTypes );
280+ AnnotationTypeMappings existing = this .mappings .putIfAbsent (annotationType , result );
281+ return (existing != null ? existing : result );
274282 }
275283
276284 private AnnotationTypeMappings createMappings (Class <? extends Annotation > annotationType ,
277285 Set <Class <? extends Annotation >> visitedAnnotationTypes ) {
286+
278287 return new AnnotationTypeMappings (this .repeatableContainers , this .filter , annotationType ,
279288 visitedAnnotationTypes );
280289 }
0 commit comments