-
-
Notifications
You must be signed in to change notification settings - Fork 34
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
6f4043a
commit 917951f
Showing
11 changed files
with
324 additions
and
38 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
8 changes: 8 additions & 0 deletions
8
...-plugin/src/main/kotlin/com/flyjingfish/android_aop_plugin/beans/ReplaceInnerClassInfo.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
package com.flyjingfish.android_aop_plugin.beans | ||
|
||
data class ReplaceInnerClassInfo( | ||
val className:String, | ||
val methodName:String, | ||
val methodDescriptor:String, | ||
val targetMethodName:String | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
39 changes: 39 additions & 0 deletions
39
...n/kotlin/com/flyjingfish/android_aop_plugin/scanner_visitor/ReplaceInvokeMethodVisitor.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
package com.flyjingfish.android_aop_plugin.scanner_visitor | ||
|
||
import com.flyjingfish.android_aop_plugin.utils.WovenInfoUtils | ||
import com.flyjingfish.android_aop_plugin.utils.printLog | ||
import org.objectweb.asm.AnnotationVisitor | ||
import org.objectweb.asm.MethodVisitor | ||
import org.objectweb.asm.Opcodes | ||
|
||
class ReplaceInvokeMethodVisitor(methodVisitor: MethodVisitor?,private val clazzName:String, | ||
private val superClazzName:String) : | ||
MethodVisitor(Opcodes.ASM9, methodVisitor) { | ||
interface OnResultListener{ | ||
fun onBack() | ||
} | ||
var onResultListener : OnResultListener?= null | ||
override fun visitMethodInsn( | ||
opcode: Int, | ||
owner: String, | ||
name: String, | ||
descriptor: String, | ||
isInterface: Boolean | ||
) { | ||
val info = WovenInfoUtils.getAopMethodCutInnerClassInfo(owner,name,descriptor,clazzName,superClazzName) | ||
val invokeName = if (info == null){ | ||
name | ||
}else{ | ||
if (owner == info.className | ||
&& info.methodName == name | ||
&& descriptor == info.methodDescriptor | ||
&& WovenInfoUtils.isHasAopMethodCutInnerClassInfoInvokeMethod(owner,info.targetMethodName,descriptor)){ | ||
onResultListener?.onBack() | ||
info.targetMethodName | ||
}else{ | ||
name | ||
} | ||
} | ||
super.visitMethodInsn(opcode, owner, invokeName, descriptor, isInterface) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.