We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
at stack depth 0, expected type java.lang.Object but found int 这个问题似乎不是你调用方法传参的问题,而是你使用aload指令操作的栈上的数据类型不对,似乎应该使用iload
The text was updated successfully, but these errors were encountered:
问题解决了
注入的方法描述:(Ljava/lang/Object;Z)V
for (def i = methodCell.paramsStart; i < methodCell.paramsStart + methodCell.paramsCount; i++) { // Todo: 这里直接传入i居然报错:at stack depth 0, expected type java.lang.Object but found int;强制转换成Object才行。why? methodVisitor.visitVarInsn(Opcodes.ALOAD, i); } // 改写成如下代码依然报错 methodVisitor.visitVarInsn(Opcodes.ALOAD, 0); if (methodCell.paramsCount == 2) { methodVisitor.visitVarInsn(Opcodes.ILOAD, 1); } methodVisitor.visitMethodInsn(Opcodes.INVOKESTATIC, ReWriterConfig.sAgentClassName, methodCell.agentName, methodCell.agentDesc, false);
出错原因:
代码执行时,输入的方法描述实际为(Ljava/lang/Object;)V,只接收一个参数,而methodCell.paramsCount仍为2,导致methodVisitor.visitVarInsn指令加载了两次。
(Ljava/lang/Object;)V
methodCell.paramsCount
methodVisitor.visitVarInsn
Sorry, something went wrong.
No branches or pull requests
at stack depth 0, expected type java.lang.Object but found int
这个问题似乎不是你调用方法传参的问题,而是你使用aload指令操作的栈上的数据类型不对,似乎应该使用iload
The text was updated successfully, but these errors were encountered: