Skip to content

Commit

Permalink
Merge pull request #9753 from lrytz/pr9733-fixup
Browse files Browse the repository at this point in the history
Change `private[concurrent]` for methods used outside `concurrent`
  • Loading branch information
lrytz committed Sep 9, 2021
2 parents 00c4865 + 0eb49ce commit 7247dfe
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 9 deletions.
7 changes: 2 additions & 5 deletions project/MimaFilters.scala
Original file line number Diff line number Diff line change
Expand Up @@ -73,11 +73,8 @@ object MimaFilters extends AutoPlugin {

// #9733
ProblemFilters.exclude[MissingClassProblem]("scala.collection.concurrent.TrieMap$RemovalPolicy$"), // private[concurrent]
// is this a MiMa bug? we really should need these two filters
//ProblemFilters.exclude[DirectMissingMethodProblem]("scala.collection.concurrent.TrieMap.removeRefEq"), // private[concurrent]
//ProblemFilters.exclude[DirectMissingMethodProblem]("scala.collection.concurrent.TrieMap.replaceRefEq"), // private[concurrent]
ProblemFilters.exclude[DirectMissingMethodProblem]("scala.collection.convert.JavaCollectionWrappers#JConcurrentMapWrapper.removeRefEq"), // private[concurrent]
ProblemFilters.exclude[DirectMissingMethodProblem]("scala.collection.convert.JavaCollectionWrappers#JConcurrentMapWrapper.replaceRefEq"), // private[concurrent]
ProblemFilters.exclude[DirectMissingMethodProblem]("scala.collection.convert.JavaCollectionWrappers#JConcurrentMapWrapper.removeRefEq"), // private[collection]
ProblemFilters.exclude[DirectMissingMethodProblem]("scala.collection.convert.JavaCollectionWrappers#JConcurrentMapWrapper.replaceRefEq"), // private[collection]

// #9741
ProblemFilters.exclude[MissingClassProblem]("scala.collection.immutable.SeqMap$SeqMapBuilderImpl"), // private[SeqMap]
Expand Down
4 changes: 2 additions & 2 deletions src/library/scala/collection/concurrent/Map.scala
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ trait Map[K, V] extends scala.collection.mutable.Map[K, V] {
* @return `true` if the removal took place, `false` otherwise
*/
// TODO: make part of the API in a future version
private[concurrent] def removeRefEq(k: K, v: V): Boolean = remove(k, v)
private[collection] def removeRefEq(k: K, v: V): Boolean = remove(k, v)

/**
* Replaces the entry for the given key only if it was previously mapped to
Expand All @@ -138,7 +138,7 @@ trait Map[K, V] extends scala.collection.mutable.Map[K, V] {
* @return `true` if the entry was replaced, `false` otherwise
*/
// TODO: make part of the API in a future version
private[concurrent] def replaceRefEq(k: K, oldValue: V, newValue: V): Boolean = replace(k, oldValue, newValue)
private[collection] def replaceRefEq(k: K, oldValue: V, newValue: V): Boolean = replace(k, oldValue, newValue)

/**
* Update a mapping for the specified key and its current optionally-mapped value
Expand Down
4 changes: 2 additions & 2 deletions src/library/scala/collection/concurrent/TrieMap.scala
Original file line number Diff line number Diff line change
Expand Up @@ -972,7 +972,7 @@ final class TrieMap[K, V] private (r: AnyRef, rtupd: AtomicReferenceFieldUpdater
removehc(k, v, RemovalPolicy.FullEquals, hc).nonEmpty
}

override private[concurrent] def removeRefEq(k: K, v: V): Boolean = {
override private[collection] def removeRefEq(k: K, v: V): Boolean = {
val hc = computeHash(k)
removehc(k, v, RemovalPolicy.ReferenceEq, hc).nonEmpty
}
Expand All @@ -982,7 +982,7 @@ final class TrieMap[K, V] private (r: AnyRef, rtupd: AtomicReferenceFieldUpdater
insertifhc(k, hc, newvalue, oldvalue.asInstanceOf[AnyRef], fullEquals = true).nonEmpty
}

override private[concurrent] def replaceRefEq(k: K, oldValue: V, newValue: V): Boolean = {
override private[collection] def replaceRefEq(k: K, oldValue: V, newValue: V): Boolean = {
val hc = computeHash(k)
insertifhc(k, hc, newValue, oldValue.asInstanceOf[AnyRef], fullEquals = false).nonEmpty
}
Expand Down

0 comments on commit 7247dfe

Please sign in to comment.