fix: reflect method error
Signed-off-by: MiaoWoo <admin@yumc.pw>
This commit is contained in:
parent
b1a4c65adb
commit
63ff11def1
@ -96,10 +96,7 @@ function types(values: any[], def?: any) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function accessible<T extends java.lang.reflect.AccessibleObject>(accessible: T): T {
|
function accessible<T extends java.lang.reflect.AccessibleObject>(accessible: T): T {
|
||||||
if (accessible === null) {
|
if (!accessible?.isAccessible()) {
|
||||||
return null
|
|
||||||
}
|
|
||||||
if (!accessible.isAccessible()) {
|
|
||||||
accessible.setAccessible(true)
|
accessible.setAccessible(true)
|
||||||
}
|
}
|
||||||
return accessible
|
return accessible
|
||||||
@ -143,7 +140,8 @@ function declaredMethod(clazz: java.lang.Class<any>, name: string, ...clazzs: ja
|
|||||||
let key = clazz.getName() + '.' + name + ':' + (clazzs || []).join(':')
|
let key = clazz.getName() + '.' + name + ':' + (clazzs || []).join(':')
|
||||||
if (!methodCache[key]) {
|
if (!methodCache[key]) {
|
||||||
try {
|
try {
|
||||||
methodCache[key] = clazz.getMethod(name, ...clazzs)
|
// @ts-ignore
|
||||||
|
methodCache[key] = clazz.getMethod(name, clazzs)
|
||||||
} catch (ex) {
|
} catch (ex) {
|
||||||
try {
|
try {
|
||||||
methodCache[key] = clazz.getDeclaredMethod(name, clazzs as any)
|
methodCache[key] = clazz.getDeclaredMethod(name, clazzs as any)
|
||||||
|
Loading…
Reference in New Issue
Block a user