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

Andrey Turbanov github.com+741251+turbanoff at openjdk.java.net
Wed Aug 25 12:50:27 UTC 2021


On Wed, 25 Aug 2021 08:29:57 GMT, Daniel Fuchs <dfuchs at openjdk.org> wrote:

>> Andrey Turbanov has updated the pull request incrementally with one additional commit since the last revision:
>> 
>>   8272863: Replace usages of Collections.sort with List.sort call in public java modules
>>   replace Collections.sort without comparator too
>
> 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?

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

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


More information about the security-dev mailing list