RFR: 8272863: Replace usages of Collections.sort with List.sort call in public java modules [v2]

Alexander Zvegintsev azvegint at openjdk.java.net
Wed Aug 25 13:36:23 UTC 2021


On Wed, 25 Aug 2021 12:47:41 GMT, Andrey Turbanov <github.com+741251+turbanoff at openjdk.org> wrote:

>> src/java.base/share/classes/java/net/URLPermission.java line 222:
>> 
>>> 220: 
>>> 221:         List<String> l = normalizeMethods(methods);
>>> 222:         l.sort(null);
>> 
>> I am not opposed to this change, but I find this is slightly more ugly than `Collections.sort(l)`; so I have to ask: Is there any noticeable benefit?
>
> Actually I agree with you.
> One more point is that List.sort(null) doesn't check at compile time that class implements `Comparable`. But Collections.sort have this check.
> I will revert last commit.
> @azvegint are you ok with that?

No objections.

-------------

PR: https://git.openjdk.java.net/jdk/pull/5229



More information about the security-dev mailing list