On Wed, 19 Feb 2025 23:54:35 GMT, Anthony Scarpino <ascarp...@openjdk.org> wrote:
>> src/java.base/share/classes/sun/security/util/AbstractAlgorithmConstraints.java >> line 79: >> >>> 77: private static List<String> aliasXDH = null; >>> 78: private static List<String> aliasX25519 = null; >>> 79: >> >> Wouldn't it be more concise to create a static algorithm-to-aliases map and >> then make getAliases() to do the map lookup? > > It's purely a memory allocation solution here. If I make a Map, I have to > populate the entries at initialization. Right now XDH and EdDSA are very > unlikely to be disabled as they are relatively new algorithms. Right, I thought it was probably done to minimize memory usage. But all those string literals will be stored in a string pool at runtime and simply re-used when we allocate a list with them. So real memory saving should be very small comparing to a static map. ------------- PR Review Comment: https://git.openjdk.org/jdk/pull/23647#discussion_r1963809024