Skip to content

Commit

Permalink
Reduce duplication
Browse files Browse the repository at this point in the history
  • Loading branch information
0xaa4eb committed Jul 6, 2024
1 parent adad8cc commit c4d4d5b
Showing 1 changed file with 12 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -96,12 +96,7 @@ public void enqueueMethodEnter(int recordingId, int callId, int methodId, @Nulla
calleeIdentityHashCode = 0;
}

Object[] argsPrepared;
if (performanceMode) {
argsPrepared = args;
} else {
argsPrepared = convert(args);
}
Object[] argsPrepared = prepareArgs(args);

appendEvent(recordingId, new EnterMethodRecordingEvent(callId, methodId, calleeTypeId, calleeIdentityHashCode, argsPrepared));
}
Expand All @@ -116,12 +111,7 @@ public void enqueueMethodEnter(int recordingId, int callId, int methodId, @Nulla
calleeTypeId = -1;
calleeIdentityHashCode = 0;
}
Object[] argsPrepared;
if (performanceMode) {
argsPrepared = args;
} else {
argsPrepared = convert(args);
}
Object[] argsPrepared = prepareArgs(args);

appendEvent(recordingId, new TimestampedEnterMethodRecordingEvent(
callId,
Expand Down Expand Up @@ -171,6 +161,16 @@ private void appendEvent(int recordingId, RecordingEvent event) {
}
}

private Object[] prepareArgs(Object[] args) {
Object[] argsPrepared;
if (performanceMode) {
argsPrepared = args;
} else {
argsPrepared = convert(args);
}
return argsPrepared;
}

private Object[] convert(Object[] args) {
for (int i = 0; i < args.length; i++) {
args[i] = convert(args[i]);
Expand Down

0 comments on commit c4d4d5b

Please sign in to comment.