mirror of
https://github.com/alibaba/testable-mock.git
synced 2025-01-10 20:30:11 +08:00
mn.parameters could be null
This commit is contained in:
parent
d816726f4f
commit
da3eca3d49
@ -52,6 +52,7 @@ public class TestClassHandler extends BaseClassHandler {
|
|||||||
private void handleAnnotation(ClassNode cn, MethodNode mn) {
|
private void handleAnnotation(ClassNode cn, MethodNode mn) {
|
||||||
List<String> visibleAnnotationNames = new ArrayList<String>();
|
List<String> visibleAnnotationNames = new ArrayList<String>();
|
||||||
if (mn.visibleAnnotations == null) {
|
if (mn.visibleAnnotations == null) {
|
||||||
|
// let's assume test case should has a annotation, e.g. @Test or whatever
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
for (AnnotationNode n : mn.visibleAnnotations) {
|
for (AnnotationNode n : mn.visibleAnnotations) {
|
||||||
@ -100,7 +101,7 @@ public class TestClassHandler extends BaseClassHandler {
|
|||||||
private void injectInvokeRecorder(MethodNode mn) {
|
private void injectInvokeRecorder(MethodNode mn) {
|
||||||
InsnList il = new InsnList();
|
InsnList il = new InsnList();
|
||||||
List<Byte> types = ClassUtil.getParameterTypes(mn.desc);
|
List<Byte> types = ClassUtil.getParameterTypes(mn.desc);
|
||||||
int size = mn.parameters.size();
|
int size = types.size();
|
||||||
int parameterOffset = 1;
|
int parameterOffset = 1;
|
||||||
il.add(getIntInsn(size));
|
il.add(getIntInsn(size));
|
||||||
il.add(new TypeInsnNode(ANEWARRAY, ClassUtil.CLASS_OBJECT));
|
il.add(new TypeInsnNode(ANEWARRAY, ClassUtil.CLASS_OBJECT));
|
||||||
|
@ -1,6 +1,5 @@
|
|||||||
package com.alibaba.testable.core.accessor;
|
package com.alibaba.testable.core.accessor;
|
||||||
|
|
||||||
import com.alibaba.testable.core.util.InvokeRecordUtil;
|
|
||||||
import com.alibaba.testable.core.util.TypeUtil;
|
import com.alibaba.testable.core.util.TypeUtil;
|
||||||
|
|
||||||
import java.lang.reflect.Field;
|
import java.lang.reflect.Field;
|
||||||
|
Loading…
Reference in New Issue
Block a user