On Thu, 21 Oct 2021 13:03:04 GMT, Weijun Wang <wei...@openjdk.org> wrote:
>> Ok, will remove. But I will keep this method separate since, unlike the ctor >> it needs to check if `trustedPubKey` is `null` before setting the >> `prevPubKey`. > > OK, but in the ctor `trustedPubKey` is also null. True, but that's because none of the fields are set yet, so it feels odd for the ctor to check if the field is null when it is always true, even if it is a different method. What if I create a separate method `setTrustAnchor(TrustAnchor)` which the ctor calls, and then change `trySetTrustAnchor` to: if (this.trustedPubKey == null) { setTrustAnchor(anchor); } ------------- PR: https://git.openjdk.java.net/jdk/pull/5928