Properly invoke method

This commit is contained in:
topjohnwu 2019-11-10 14:59:19 -05:00
parent ad40e53349
commit 1a38f25bd9

View File

@ -111,7 +111,7 @@ fun ClassLoader.forceLoadClass(name: String) =
runCatching { loadClass.invoke(this, name) }.getOrNull() as Class<*>? runCatching { loadClass.invoke(this, name) }.getOrNull() as Class<*>?
fun Class<*>.forceGetDeclaredMethod(name: String, vararg types: Class<*>) = fun Class<*>.forceGetDeclaredMethod(name: String, vararg types: Class<*>) =
(runCatching { getDeclaredMethod.invoke(this, name, *types) }.getOrNull() as Method?)?.also { (runCatching { getDeclaredMethod.invoke(this, name, types) }.getOrNull() as Method?)?.also {
it.isAccessible = true it.isAccessible = true
} }