From 63ff11def186bdec536eb1010c117c5ac6c4a76b Mon Sep 17 00:00:00 2001 From: MiaoWoo Date: Sat, 11 Jul 2020 15:08:02 +0800 Subject: [PATCH] fix: reflect method error Signed-off-by: MiaoWoo --- packages/common/src/reflect.ts | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/packages/common/src/reflect.ts b/packages/common/src/reflect.ts index ea58930b..8e2e4c6e 100644 --- a/packages/common/src/reflect.ts +++ b/packages/common/src/reflect.ts @@ -96,10 +96,7 @@ function types(values: any[], def?: any) { } function accessible(accessible: T): T { - if (accessible === null) { - return null - } - if (!accessible.isAccessible()) { + if (!accessible?.isAccessible()) { accessible.setAccessible(true) } return accessible @@ -143,7 +140,8 @@ function declaredMethod(clazz: java.lang.Class, name: string, ...clazzs: ja let key = clazz.getName() + '.' + name + ':' + (clazzs || []).join(':') if (!methodCache[key]) { try { - methodCache[key] = clazz.getMethod(name, ...clazzs) + // @ts-ignore + methodCache[key] = clazz.getMethod(name, clazzs) } catch (ex) { try { methodCache[key] = clazz.getDeclaredMethod(name, clazzs as any)