mirror of
https://gitee.com/chinabugotech/hutool.git
synced 2025-04-19 03:01:48 +08:00
fix bug
This commit is contained in:
parent
49e40132ac
commit
94d5889b1c
@ -138,7 +138,9 @@ public class CombinationAnnotationElement implements AnnotatedElement, Serializa
|
||||
// 直接注解
|
||||
for (final Annotation annotation : annotations) {
|
||||
annotationType = annotation.annotationType();
|
||||
if (false == META_ANNOTATIONS.contains(annotationType)) {
|
||||
if (false == META_ANNOTATIONS.contains(annotationType)
|
||||
// issue#I5FQGW@Gitee:跳过元注解和已经处理过的注解,防止递归调用
|
||||
&& false == declaredAnnotationMap.containsKey(annotationType)) {
|
||||
if(test(annotation)){
|
||||
declaredAnnotationMap.put(annotationType, annotation);
|
||||
}
|
||||
@ -157,7 +159,9 @@ public class CombinationAnnotationElement implements AnnotatedElement, Serializa
|
||||
Class<? extends Annotation> annotationType;
|
||||
for (final Annotation annotation : annotations) {
|
||||
annotationType = annotation.annotationType();
|
||||
if (false == META_ANNOTATIONS.contains(annotationType)) {
|
||||
if (false == META_ANNOTATIONS.contains(annotationType)
|
||||
// issue#I5FQGW@Gitee:跳过元注解和已经处理过的注解,防止递归调用
|
||||
&& false == declaredAnnotationMap.containsKey(annotationType)) {
|
||||
if(test(annotation)){
|
||||
annotationMap.put(annotationType, annotation);
|
||||
}
|
||||
|
@ -11,14 +11,14 @@ public class AnnotationUtilTest {
|
||||
public void getCombinationAnnotationsTest(){
|
||||
final Annotation[] annotations = AnnotationUtil.getAnnotations(ClassWithAnnotation.class, true);
|
||||
Assert.assertNotNull(annotations);
|
||||
Assert.assertEquals(3, annotations.length);
|
||||
Assert.assertEquals(2, annotations.length);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void getCombinationAnnotationsWithClassTest(){
|
||||
final AnnotationForTest[] annotations = AnnotationUtil.getCombinationAnnotations(ClassWithAnnotation.class, AnnotationForTest.class);
|
||||
Assert.assertNotNull(annotations);
|
||||
Assert.assertEquals(2, annotations.length);
|
||||
Assert.assertEquals(1, annotations.length);
|
||||
Assert.assertEquals("测试", annotations[0].value());
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user