com.flyjingfish.android_aop_plugin.utils.ClassPoolUtils.kt Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of android-aop-plugin Show documentation
Show all versions of android-aop-plugin Show documentation
Lightweight Aop for Android platform, you deserve it, action is worse than your heartbeat
package com.flyjingfish.android_aop_plugin.utils
import javassist.ClassPool
import javassist.NotFoundException
object ClassPoolUtils {
var classPool : ClassPool ?= null
get() {
if (field == null){
field = initClassPool()
}
return field
}
fun initClassPool():ClassPool {
val classPool = ClassPool(null)
classPool.appendSystemPath()
for (classPath in WovenInfoUtils.classPaths) {
try {
classPool.appendClassPath(classPath)
} catch (_: NotFoundException) {
}
}
this.classPool = classPool
return classPool
}
fun getNewClassPool(): ClassPool {
val classPool = ClassPool(null)
classPool.appendSystemPath()
for (classPath in WovenInfoUtils.classPaths) {
try {
classPool.appendClassPath(classPath)
} catch (_: NotFoundException) {
}
}
return classPool
}
}