On Mon, 3 Mar 2025 23:24:29 GMT, Valerie Peng <[email protected]> wrote:
>> Francisco Ferrari Bihurriet has updated the pull request incrementally with
>> one additional commit since the last revision:
>>
>> Clear ServicesMap fields in the declared order
>>
>> Constructors assign the fields in the same order.
>
> src/java.base/share/classes/java/security/Provider.java line 713:
>
>> 711: */
>> 712: private record MappingInfo(Service svc, ServiceKey algKey,
>> 713: Boolean isLegacy) {}
>
> There is comment states that `isLegacy` may be null, but then I also see a
> few if-cond using `isLegacy` directly like its a boolean, wouldn't it lead to
> NPE if `isLegacy` is `null`?
`isLegacy` is null when the service was never added to the ServicesMap and the
Current vs. Legacy API question does not apply. In these cases, the
`MappingInfo` record returned by `find` has a null service too, indicating that
the query did not find the service. For a caller, this case reads as the
`isLegacy` value of a not found service, and will be ignored. You can check how
all uses of `<mapping-info>.isLegacy` are in a conditional block where
`<mapping-info>.svc` is not null or in a method where we have that
pre-condition.
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/22613#discussion_r2025577715