mirror of
https://github.com/alibaba/testable-mock.git
synced 2025-03-14 03:40:25 +08:00
should always load array variable via aload
This commit is contained in:
parent
2bbe2eba93
commit
ba951ce744
@ -115,17 +115,23 @@ public class ClassUtil {
|
||||
public static List<Byte> getParameterTypes(String desc) {
|
||||
List<Byte> parameterTypes = new ArrayList<Byte>();
|
||||
boolean travelingClass = false;
|
||||
boolean travelingArray = false;
|
||||
for (byte b : desc.getBytes()) {
|
||||
if (travelingClass) {
|
||||
if (b == CLASS_END) {
|
||||
travelingClass = false;
|
||||
travelingArray = false;
|
||||
}
|
||||
} else {
|
||||
if (isPrimaryType(b)) {
|
||||
parameterTypes.add(b);
|
||||
// should treat primary array as class (issue-48)
|
||||
parameterTypes.add(travelingArray ? TYPE_CLASS : b);
|
||||
travelingArray = false;
|
||||
} else if (b == TYPE_CLASS) {
|
||||
travelingClass = true;
|
||||
parameterTypes.add(b);
|
||||
} else if (b == TYPE_ARRAY) {
|
||||
travelingArray = true;
|
||||
} else if (b == PARAM_END) {
|
||||
break;
|
||||
}
|
||||
|
@ -25,6 +25,7 @@ public class InvokeRecordUtil {
|
||||
* Record mock method invoke event
|
||||
* @param args invocation parameters
|
||||
* @param isConstructor whether mocked method is constructor
|
||||
* @param isTargetClassInParameter whether use first parameter as target class
|
||||
*/
|
||||
public static void recordMockInvoke(Object[] args, boolean isConstructor, boolean isTargetClassInParameter) {
|
||||
StackTraceElement mockMethodTraceElement = Thread.currentThread().getStackTrace()[INDEX_OF_TEST_CLASS];
|
||||
|
Loading…
Reference in New Issue
Block a user