On Sun, 18 Jan 2026 10:32:57 GMT, Hannes Greule <[email protected]> wrote:
>>> This will always be used if we are using `JarLoader`, which seems to be >>> used in the majority of cases. >> >> Not exactly, `push` is only called when the JAR uses the 'Class-Path:' >> attribute. I don't have data to support this, but from personal experience I >> don't see this being used too often. >> >>> I recommend initializing this dfs variable unconditionally. >> >> GIven the above, do you still think it's worth initializing this eagerly? It >> would allow us to make the field final and avoid a null check. >> >> EDIT: Decided to initialize eagerly and make the field final, see below. > > `ArrayList` initializes its backing array lazily when using that constructor, > so I think there isn't much reason to do a "double lazy" initialization. > > (It *might* make sense to initialize the list with a different size (e.g. > `urls.length`), but I guess we'd need some real-world data on this. And I > don't think that's worth the effort.) Alright, seems I was too eager on this lazy initialization :) I have made the field final. ------------- PR Review Comment: https://git.openjdk.org/jdk/pull/29288#discussion_r2702321343
