desruisseaux opened a new pull request, #2347: URL: https://github.com/apache/maven/pull/2347
This is an alternative to pull request #2219 resolving the same issue, but with more emphasis that `PathModularizationCache` should not be created in the `DefaultDependencyResolverResult` constructor, and that doing so is a temporary hack that may be removed in a future version. More specifically: * Make package-private the `DefaultDependencyResolverResult` constructor having a `PathModularizationCache` argument, because the latter is package-private. * Add a public constructor without the cache argument for codes in other packages that need to instantiate `DefaultDependencyResolverResult` directly. * Put a warning in the javadoc saying that this constructor may be removed in a future version. * Add `PathModularizationCache` private field in `DefaultDependencyResolver`. This is partially for performance reasons (see below), but also for expressing the intend that the cache has a longer lifetime than `DependencyResolverResult`. ## Rational Initializing `PathModularizationCache` inside the `DependencyResolverResult` constructor is close to useless, because a cache is useful only when the cached values are reused. The way that the `DependencyResolverResult` is coded, the same result instance is unlikely to ask the same cached value twice. The cache become useful only when many `DependencyResolverResult` are instantiated while reusing the same cache. The "useless" approach is nevertheless used by `DependencyResolverResult`, but this is only because I do not yet know how to manage a session-wide cache. The current way to create the cache was intended to be temporary. I'm not sure if it happens often that the same `DependencyResolverResultBuilder` is reused for creating more than one `DependencyResolverResult`. If not, moving the cache inside `DependencyResolverResultBuilder`, as done in this commit, may not bring real performance improvement. However, it makes clearer that `PathModularizationCache` is expected to have a longer lifetime than `DependencyResolverResult`. The discussion in #2219 gives the impression that such clarification is worth to do. -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: issues-unsubscr...@maven.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org