Refactor sanitizeStackTrace function to spare allocations
Use Arrays.copyOfRange instead of List.subList.toArray.
This commit is contained in:
@@ -248,8 +248,8 @@ public class Intrinsics {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
List<StackTraceElement> list = Arrays.asList(stackTrace).subList(lastIntrinsic + 1, size);
|
StackTraceElement[] newStackTrace = Arrays.copyOfRange(stackTrace, lastIntrinsic + 1, size);
|
||||||
throwable.setStackTrace(list.toArray(new StackTraceElement[list.size()]));
|
throwable.setStackTrace(newStackTrace);
|
||||||
return throwable;
|
return throwable;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user