diff --git a/panda-beans/src/main/java/org/panda/beans/util/BeanUtil.java b/panda-beans/src/main/java/org/panda/beans/util/BeanUtil.java index 04888d5..cefd4dd 100644 --- a/panda-beans/src/main/java/org/panda/beans/util/BeanUtil.java +++ b/panda-beans/src/main/java/org/panda/beans/util/BeanUtil.java @@ -1,6 +1,7 @@ package org.panda.beans.util; +import com.sun.tools.javac.util.Assert; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -27,8 +28,8 @@ public class BeanUtil { */ public static List getAllField(Class clazz){ Field[] fields = getField(clazz); - List fieldList = new ArrayList<>(); Field[] superFields = getSuperField(clazz); + List fieldList = new ArrayList<>(fields.length+superFields.length); if (superFields!=null&&superFields.length>0){ for (Field field:superFields) { fieldList.add(field); @@ -217,6 +218,7 @@ public class BeanUtil { */ public static T instantiateClass(Class clazz){ T t = null; + Assert.checkNonNull(clazz); try { t = clazz.newInstance(); } catch (InstantiationException e) { @@ -237,6 +239,7 @@ public class BeanUtil { */ public static T instantiateClass(Class clazz,Object... params){ T t = null; + Assert.checkNonNull(clazz); Class[] classes = new Class[params.length]; for (int i=0;i