@@ -10,6 +10,9 @@ import lanchon.multidexlib2.BasicDexFileNamer
10
10
import lanchon.multidexlib2.MultiDexIO
11
11
import java.io.File
12
12
import java.io.InputStream
13
+ import java.lang.reflect.Member
14
+ import java.lang.reflect.Method
15
+ import java.lang.reflect.Modifier
13
16
import java.net.URLClassLoader
14
17
import java.util.jar.JarFile
15
18
import kotlin.reflect.KProperty
@@ -636,7 +639,7 @@ sealed class PatchLoader private constructor(
636
639
*/
637
640
private val Class <* >.patchFields
638
641
get() = fields.filter { field ->
639
- field.type.isPatch && field.canAccess(null )
642
+ field.type.isPatch && field.canAccess()
640
643
}.map { field ->
641
644
field.get(null ) as Patch <* >
642
645
}
@@ -646,7 +649,7 @@ sealed class PatchLoader private constructor(
646
649
*/
647
650
private val Class <* >.patchMethods
648
651
get() = methods.filter { method ->
649
- method.returnType.isPatch && method.parameterCount == 0 && method.canAccess(null )
652
+ method.returnType.isPatch && method.parameterCount == 0 && method.canAccess()
650
653
}.map { method ->
651
654
method.invoke(null ) as Patch <* >
652
655
}
@@ -670,6 +673,12 @@ sealed class PatchLoader private constructor(
670
673
it.name != null
671
674
}.toSet()
672
675
}
676
+
677
+ private fun Member.canAccess (): Boolean {
678
+ if (this is Method && parameterCount != 0 ) return false
679
+
680
+ return Modifier .isStatic(modifiers) && Modifier .isPublic(modifiers)
681
+ }
673
682
}
674
683
}
675
684
0 commit comments