On Tue, 25 Feb 2025 23:49:41 GMT, Valerie Peng <valer...@openjdk.org> 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 2202: > >> 2200: "Attribute value expected to exist with the same >> identity."; >> 2201: attributes.remove(attrKey, attrValue); >> 2202: } > > Is the new impl assuming `attrValue` should never be `null`? Based on javadoc > of `Map.remove(Object key, Object value)`, the new impl removes the entry > when the associated value is `null` vs the original impl removes the entry > regardless of the associated value. Yes, the new implementation assumes `attrValue` isn't `null`. For cases in which the old implementation was receiving `null`, the new implementation receives `oldValue`, from `Provider::implRemove`: https://github.com/openjdk/jdk/blob/3d0df51b634e02e95ee66c4121460e8fe6b9d9be/src/java.base/share/classes/java/security/Provider.java#L1535-L1539 This is also asserted as `attrValue != null` in `Provider.ServicesMap::removeAttributeLegacy`, the caller of `Service::removeAttribute`: https://github.com/openjdk/jdk/blob/3d0df51b634e02e95ee66c4121460e8fe6b9d9be/src/java.base/share/classes/java/security/Provider.java#L1319-L1329 ------------- PR Review Comment: https://git.openjdk.org/jdk/pull/22613#discussion_r2025285785