Fixed flaky tests

This commit is contained in:
yeshwanthsripathy 2023-10-03 18:52:31 -05:00
parent 20f0c720c4
commit 21f6554a05
2 changed files with 4 additions and 0 deletions

View File

@ -7,6 +7,7 @@ import java.lang.annotation.Annotation;
import java.lang.reflect.AnnotatedElement;
import java.util.Arrays;
import java.util.Collection;
import java.util.Comparator;
import java.util.Map;
import java.util.function.Predicate;
@ -98,10 +99,12 @@ public class CombinationAnnotationElement implements AnnotatedElement, Serializa
*/
private void init(AnnotatedElement element) {
final Annotation[] declaredAnnotations = element.getDeclaredAnnotations();
Arrays.sort(declaredAnnotations, Comparator.comparing(Annotation::toString));
this.declaredAnnotationMap = new TableMap<>();
parseDeclared(declaredAnnotations);
final Annotation[] annotations = element.getAnnotations();
Arrays.sort(annotations, Comparator.comparing(Annotation::toString));
if (Arrays.equals(declaredAnnotations, annotations)) {
this.annotationMap = this.declaredAnnotationMap;
} else {

View File

@ -185,6 +185,7 @@ public abstract class AbstractTypeAnnotationScanner<T extends AbstractTypeAnnota
scanInterfaceIfNecessary(nextClassQueue, targetClass);
// 处理层级索引和注解
final Annotation[] targetAnnotations = getAnnotationsFromTargetClass(annotatedEle, index, targetClass);
Arrays.sort(targetAnnotations, Comparator.comparing(Annotation::toString).reversed());
for (final Annotation annotation : targetAnnotations) {
if (AnnotationUtil.isNotJdkMateAnnotation(annotation.annotationType()) && filter.test(annotation)) {
consumer.accept(index, annotation);