Community
Participate
Working Groups
See the Spring bug https://jira.spring.io/browse/SPR-13380. I don't have a spring test case but I determined that the inflate() mechanism in RuntimeAnnos (and in RuntimeParamAnnos) can get into trouble if two threads are in it at the same time for the same JavaClass. The Java15AnnotationFinder says: JavaClass jc = bcelRepository.loadClass(forClass); org.aspectj.apache.bcel.classfile.annotation.AnnotationGen[] anns = jc.getAnnotations(); bcelRepository.clear(); if (anns == null) return ResolvedType.NONE; ResolvedType[] ret = new ResolvedType[anns.length]; for (int i = 0; i < ret.length; i++) { ret[i] = inWorld.resolve(UnresolvedType.forSignature(anns[i].getTypeSignature())); } return ret; If two threads go through here asking about the same class they will potentially get the same JavaClass back from the repository (if the first thread hasn't called 'clear' before the second thread asks the repository for the class). Annotations are unpacked on demand and if two threads ask for them at the same time they will both be unpacking simultaneously and the unpack code is not thread safe.
Made RuntimeAnnos inflate() safe, and RuntimeParamAnnos too which had the same issue (but no-one seems to have hit that yet).