Compat behavior for Collections.sort()
AOSP libcore commit 5ae9d084 changed Collections.sort() to call List.sort() rather than vice versa. This causes infinite recursions in apps that call Collections.sort() from List.sort(). (It can also lead to a behavior difference with respect to modCount). Since popular such apps exist, this CL guards the new behavior by a targetSdkVersion check so that only apps targeting (and running on) API versions > 25 observe the new behavior of Collections.sort() calling List.sort(). The previous documentation for List.sort() was also inappropriate since it recommended calling super.sort(), which will only work on API level 24+ which introduced that method. Tests temporarily set appropriate targetSdkVersions. Bug: 33482884 Bug: 34072201 Test: CtsLibcoreTestCases (includes CollectionsTest) Change-Id: I57cf18895e1d03cb43ff1c8232a75744fe94b78f
Loading
Please sign in to comment