From 8b90dce242466802491c6998dec4d29e5a054dc7 Mon Sep 17 00:00:00 2001 From: 502647092 Date: Sat, 4 Feb 2017 20:38:20 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E7=A7=81=E6=9C=89=E6=9E=84=E9=80=A0?= =?UTF-8?q?=E5=99=A8=E6=97=A0=E6=B3=95=E5=AE=9E=E4=BE=8B=E5=8C=96=E7=9A=84?= =?UTF-8?q?=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: 502647092 --- .../yumc/YumCore/config/inject/AbstractInjectConfig.java | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/main/java/pw/yumc/YumCore/config/inject/AbstractInjectConfig.java b/src/main/java/pw/yumc/YumCore/config/inject/AbstractInjectConfig.java index b025b75..804f540 100644 --- a/src/main/java/pw/yumc/YumCore/config/inject/AbstractInjectConfig.java +++ b/src/main/java/pw/yumc/YumCore/config/inject/AbstractInjectConfig.java @@ -1,5 +1,6 @@ package pw.yumc.YumCore.config.inject; +import java.lang.reflect.Constructor; import java.lang.reflect.Field; import java.lang.reflect.InvocationTargetException; import java.lang.reflect.Modifier; @@ -90,7 +91,11 @@ public abstract class AbstractInjectConfig { */ private Object hanldeDefault(Class field, String path, Object value) throws IllegalAccessException, IllegalArgumentException, InstantiationException, InvocationTargetException, NoSuchMethodException, SecurityException { if (InjectConfigurationSection.class.isAssignableFrom(field)) { - if (config.isConfigurationSection(path)) { return field.getConstructor(ConfigurationSection.class).newInstance(config.getConfigurationSection(path)); } + if (config.isConfigurationSection(path)) { + Constructor constructor = field.getDeclaredConstructor(ConfigurationSection.class); + constructor.setAccessible(true); + return constructor.newInstance(config.getConfigurationSection(path)); + } Log.w(INJECT_TYPE_ERROR, path, ConfigurationSection.class.getName(), value.getClass().getName()); } return value;