mirror of
https://github.com/alibaba/testable-mock.git
synced 2025-01-10 12:20:09 +08:00
fit INVOKEDYNAMIC
This commit is contained in:
parent
6951b98c7e
commit
ef5d21baf6
@ -1,5 +1,9 @@
|
|||||||
# Release Note
|
# Release Note
|
||||||
|
|
||||||
|
## 0.4.10
|
||||||
|
- fix an issue of using mock in lambda expression
|
||||||
|
- fix the NullPointerException when invoke private method with parameter value `null`
|
||||||
|
|
||||||
## 0.4.9
|
## 0.4.9
|
||||||
- fix an issue cause by improperly bytecode processing while using `targetClass` parameter
|
- fix an issue cause by improperly bytecode processing while using `targetClass` parameter
|
||||||
- auto validate access target of `PrivateAccessor`, improve resistance to code refactoring
|
- auto validate access target of `PrivateAccessor`, improve resistance to code refactoring
|
||||||
|
@ -1,5 +1,9 @@
|
|||||||
# Release Note
|
# Release Note
|
||||||
|
|
||||||
|
## 0.4.10
|
||||||
|
- 修复在Lambda函数中使用Mock出错的BUG(issue-44)
|
||||||
|
- 修复调用私有方法时参数值不能为null的问题(issue-27)
|
||||||
|
|
||||||
## 0.4.9
|
## 0.4.9
|
||||||
- 修复发起调用的对象不是局部或成员变量时Mock出错的BUG (issue-40)
|
- 修复发起调用的对象不是局部或成员变量时Mock出错的BUG (issue-40)
|
||||||
- 增加`PrivateAccessor`访问目标有效性检查,提高抗代码重构能力 (issue-21)
|
- 增加`PrivateAccessor`访问目标有效性检查,提高抗代码重构能力 (issue-21)
|
||||||
|
@ -175,10 +175,11 @@ public class SourceClassHandler extends BaseClassHandler {
|
|||||||
case Opcodes.INVOKESPECIAL:
|
case Opcodes.INVOKESPECIAL:
|
||||||
case Opcodes.INVOKEVIRTUAL:
|
case Opcodes.INVOKEVIRTUAL:
|
||||||
case Opcodes.INVOKEINTERFACE:
|
case Opcodes.INVOKEINTERFACE:
|
||||||
return stackEffectOfInvocation(instruction) + 1;
|
return stackEffectOfInvocation(((MethodInsnNode)instruction).desc) + 1;
|
||||||
case Opcodes.INVOKESTATIC:
|
case Opcodes.INVOKESTATIC:
|
||||||
|
return stackEffectOfInvocation(((MethodInsnNode)instruction).desc);
|
||||||
case Opcodes.INVOKEDYNAMIC:
|
case Opcodes.INVOKEDYNAMIC:
|
||||||
return stackEffectOfInvocation(instruction);
|
return stackEffectOfInvocation(((InvokeDynamicInsnNode)instruction).desc);
|
||||||
case -1:
|
case -1:
|
||||||
// either LabelNode or LineNumberNode
|
// either LabelNode or LineNumberNode
|
||||||
return 0;
|
return 0;
|
||||||
@ -187,8 +188,7 @@ public class SourceClassHandler extends BaseClassHandler {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private int stackEffectOfInvocation(AbstractInsnNode instruction) {
|
private int stackEffectOfInvocation(String desc) {
|
||||||
String desc = ((MethodInsnNode)instruction).desc;
|
|
||||||
return ClassUtil.getParameterTypes(desc).size() - (ClassUtil.getReturnType(desc).isEmpty() ? 0 : 1);
|
return ClassUtil.getParameterTypes(desc).size() - (ClassUtil.getReturnType(desc).isEmpty() ? 0 : 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user