Merge pull request #8158 from eed3si9n/fport/coursier

[2.x] fport: Ensure caching uses weak references
This commit is contained in:
eugene yokota 2025-06-08 00:09:00 -04:00 committed by GitHub
commit 8dac9db39e
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 2 additions and 3 deletions

View File

@ -1,8 +1,7 @@
package lmcoursier.internal
import java.io.File
import java.util.GregorianCalendar
import java.util.concurrent.ConcurrentHashMap
import java.util.{ Collections, GregorianCalendar, WeakHashMap }
import coursier.cache.CacheUrl
import coursier.{ Attributes, Dependency, Module, Project, Resolution }
import coursier.core.{ Classifier, Configuration, Extension, Info, Publication, Type }
@ -18,7 +17,7 @@ private[internal] object SbtUpdateReport {
private def caching[K, V](f: K => V): K => V = {
val cache = new ConcurrentHashMap[K, V]
val cache = Collections.synchronizedMap(new WeakHashMap[K, V])
key =>
val previousValueOpt = Option(cache.get(key))