mirror of
https://gitee.com/dromara/hutool.git
synced 2025-04-05 17:37:59 +08:00
修复AnnotationUtil可能的空指针错误
This commit is contained in:
parent
43c417e76c
commit
ef5447add7
@ -9,6 +9,7 @@
|
|||||||
* 【core 】 ListUtil增加move方法(issue#3603@Github)
|
* 【core 】 ListUtil增加move方法(issue#3603@Github)
|
||||||
|
|
||||||
### 🐞Bug修复
|
### 🐞Bug修复
|
||||||
|
* 【core 】 修复AnnotationUtil可能的空指针错误
|
||||||
|
|
||||||
-------------------------------------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------------------------------------
|
||||||
# 5.8.28(2024-05-29)
|
# 5.8.28(2024-05-29)
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
package cn.hutool.core.annotation;
|
package cn.hutool.core.annotation;
|
||||||
|
|
||||||
import cn.hutool.core.map.TableMap;
|
import cn.hutool.core.map.TableMap;
|
||||||
|
import cn.hutool.core.util.ArrayUtil;
|
||||||
|
|
||||||
import java.io.Serializable;
|
import java.io.Serializable;
|
||||||
import java.lang.annotation.Annotation;
|
import java.lang.annotation.Annotation;
|
||||||
@ -116,6 +117,10 @@ public class CombinationAnnotationElement implements AnnotatedElement, Serializa
|
|||||||
* @param annotations Class, Method, Field等
|
* @param annotations Class, Method, Field等
|
||||||
*/
|
*/
|
||||||
private void parseDeclared(Annotation[] annotations) {
|
private void parseDeclared(Annotation[] annotations) {
|
||||||
|
if(ArrayUtil.isEmpty(annotations)){
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
Class<? extends Annotation> annotationType;
|
Class<? extends Annotation> annotationType;
|
||||||
// 直接注解
|
// 直接注解
|
||||||
for (Annotation annotation : annotations) {
|
for (Annotation annotation : annotations) {
|
||||||
@ -138,6 +143,10 @@ public class CombinationAnnotationElement implements AnnotatedElement, Serializa
|
|||||||
* @param annotations Class, Method, Field等
|
* @param annotations Class, Method, Field等
|
||||||
*/
|
*/
|
||||||
private void parse(Annotation[] annotations) {
|
private void parse(Annotation[] annotations) {
|
||||||
|
if(ArrayUtil.isEmpty(annotations)){
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
Class<? extends Annotation> annotationType;
|
Class<? extends Annotation> annotationType;
|
||||||
for (Annotation annotation : annotations) {
|
for (Annotation annotation : annotations) {
|
||||||
annotationType = annotation.annotationType();
|
annotationType = annotation.annotationType();
|
||||||
|
Loading…
Reference in New Issue
Block a user