RFR: [8u] 8225392: Comparison builds are failing due to cacerts file
Andrew John Hughes
gnu.andrew at redhat.com
Thu Feb 13 20:46:16 UTC 2020
On 13/02/2020 16:54, Aleksey Shipilev wrote:
> On 2/13/20 8:27 AM, Andrew John Hughes wrote:
>> Bug: https://bugs.openjdk.java.net/browse/JDK-8225392
>> Webrev: https://cr.openjdk.java.net/~andrew/openjdk8/8225392/webrev.01/
>>
>> This is the follow-up to 8193255 and requires similar changes to
>> GenerateCacerts.java in order for it to build during bootstrap with
>> OpenJDK 7.
>>
>> Differences from 11u version:
>>
>> 1. In GenerateCacerts.java, we again use a loop over the directory
>> entries using Files.newDirectoryStream rather than a bunch of lambda
>> functions and the Streams API. Instead of creating an unsorted list and
>> then sorting it, we just add the entries directly to a TreeSet.
>
> But since String has the natural ordering comparator, why do you need another Comparator, which
> calls to String's comparator anyway?
>
> 87 SortedSet<String> entries = new TreeSet<String>(new Comparator<String> () {
> 88 @Override
> 89 public int compare(String s1, String s2) { return s1.compareTo(s2); }
> 90 });
>
> Surely you can just do:
>
> Collection<String> entries = new TreeSet<String>();
>
> Otherwise looks good.
>
I knew there must have been a simpler solution there, but I was thrown
off by the use of entries.sort(String::compareTo); in the original patch
(i.e. it constructs this same Comparator implicitly using the ::
notation). This explains why my search for an existing String Comparator
instance was fruitless. As with the previous patch, I think we're
actually improving the efficiency of this slightly by using the
conventional API rather than the functional one.
Revised version with the no-args constructor:
https://cr.openjdk.java.net/~andrew/openjdk8/8225392/webrev.02/
Thanks,
--
Andrew :)
Senior Free Java Software Engineer
Red Hat, Inc. (http://www.redhat.com)
PGP Key: ed25519/0xCFDA0F9B35964222 (hkp://keys.gnupg.net)
Fingerprint = 5132 579D D154 0ED2 3E04 C5A0 CFDA 0F9B 3596 4222
https://keybase.io/gnu_andrew
More information about the jdk8u-dev
mailing list