Refactor sanitizeStackTrace function to spare allocations

Use Arrays.copyOfRange instead of List.subList.toArray.
This commit is contained in:
Ilya Gorbunov
2019-03-14 18:29:19 +03:00
parent ee7660065b
commit 7a038f1330
@@ -248,8 +248,8 @@ public class Intrinsics {
}
}
List<StackTraceElement> list = Arrays.asList(stackTrace).subList(lastIntrinsic + 1, size);
throwable.setStackTrace(list.toArray(new StackTraceElement[list.size()]));
StackTraceElement[] newStackTrace = Arrays.copyOfRange(stackTrace, lastIntrinsic + 1, size);
throwable.setStackTrace(newStackTrace);
return throwable;
}
}