Skip to content

Commit

Permalink
scala 2.13.16
Browse files Browse the repository at this point in the history
Switch from AnyRefMap to HashMap to fix deprecation warnings.
  • Loading branch information
brharrington committed Feb 7, 2025
1 parent 10d2461 commit 7759930
Show file tree
Hide file tree
Showing 11 changed files with 15 additions and 17 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/pr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ jobs:
strategy:
matrix:
java: [17, 23]
scala: [2.13.15, 3.5.1]
scala: [2.13.16, 3.5.1]
steps:
- uses: actions/checkout@v3
- name: Set up JDK ${{ matrix.java }}
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,5 +31,5 @@ jobs:
PGP_PASSPHRASE: ${{ secrets.ORG_SIGNING_PASSWORD }}
run: |
git fetch --unshallow --tags
cat /dev/null | project/sbt ++2.13.15 clean test +publishSigned
cat /dev/null | project/sbt ++2.13.16 clean test +publishSigned
cat /dev/null | project/sbt sonatypeBundleRelease
2 changes: 1 addition & 1 deletion .github/workflows/snapshot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,4 +31,4 @@ jobs:
PGP_PASSPHRASE: ${{ secrets.ORG_SIGNING_PASSWORD }}
run: |
git fetch --unshallow --tags
cat /dev/null | project/sbt ++2.13.15 clean test +publishSigned
cat /dev/null | project/sbt ++2.13.16 clean test +publishSigned
Original file line number Diff line number Diff line change
Expand Up @@ -247,7 +247,7 @@ object StatefulExpr {
*/
trait OnlineExpr extends StatefulExpr {

type StateMap = scala.collection.mutable.AnyRefMap[ItemId, AlgoState]
type StateMap = scala.collection.mutable.HashMap[ItemId, AlgoState]

protected def name: String

Expand Down
10 changes: 4 additions & 6 deletions atlas-core/src/main/scala/com/netflix/atlas/core/util/Hash.scala
Original file line number Diff line number Diff line change
Expand Up @@ -47,8 +47,8 @@ object Hash {
// https://github.com/jruby/jruby/commit/e840823c435393e8365be1bae93f646c1bb0043f
private val cloneableDigests = createDigests()

private def createDigests(): scala.collection.mutable.AnyRefMap[String, MessageDigest] = {
val digests = new scala.collection.mutable.AnyRefMap[String, MessageDigest]()
private def createDigests(): scala.collection.mutable.HashMap[String, MessageDigest] = {
val digests = new scala.collection.mutable.HashMap[String, MessageDigest]()
List("MD5", "SHA1").foreach { algorithm =>
Try(MessageDigest.getInstance(algorithm)).foreach { digest =>
// Try to clone the digest to make sure it is cloneable
Expand All @@ -61,11 +61,9 @@ object Hash {
}

def get(algorithm: String): MessageDigest = {
val digest = cloneableDigests.getOrNull(algorithm)
if (digest != null)
cloneableDigests.get(algorithm).fold(MessageDigest.getInstance(algorithm)) { digest =>
digest.clone().asInstanceOf[MessageDigest]
else
MessageDigest.getInstance(algorithm)
}
}

def md5(input: Array[Byte]): BigInteger = {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -217,7 +217,7 @@ object AggrDatapoint {
private class GroupByAggregator(settings: AggregatorSettings) extends Aggregator(settings) {

private val aggregators =
scala.collection.mutable.AnyRefMap.empty[Map[String, String], Aggregator]
scala.collection.mutable.HashMap.empty[Map[String, String], Aggregator]

private def newAggregator(datapoint: AggrDatapoint): Aggregator = {
datapoint.expr match {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ private[stream] class FinalExprEval(exprInterpreter: ExprInterpreter, enableNoDa
// Maintains the state for each expression we need to evaluate. TODO: implement
// limits to sanity check against running of our memory
private val states =
scala.collection.mutable.AnyRefMap.empty[StyleExpr, Map[StatefulExpr, Any]]
scala.collection.mutable.HashMap.empty[StyleExpr, Map[StatefulExpr, Any]]

// Step size for datapoints flowing through, it will be determined by the first data
// sources message that arrives and should be consistent for the life of this stage
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,8 +61,8 @@ private[stream] class LwcToAggrDatapoint(context: StreamContext)
override def createLogic(inheritedAttributes: Attributes): GraphStageLogic = {
new GraphStageLogic(shape) with InHandler with OutHandler {

private val tsState = scala.collection.mutable.AnyRefMap.empty[String, DatapointMetadata]
private val eventState = scala.collection.mutable.AnyRefMap.empty[String, String]
private val tsState = scala.collection.mutable.HashMap.empty[String, DatapointMetadata]
private val eventState = scala.collection.mutable.HashMap.empty[String, String]

override def onPush(): Unit = {
val dpBuilder = List.newBuilder[AggrDatapoint]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ object ClusterOps extends StrictLogging {
new GraphStageLogic(shape) with InHandler with OutHandler {

private val registry = context.registry
private val membersSources = mutable.AnyRefMap.empty[M, SourceQueue[D]]
private val membersSources = mutable.HashMap.empty[M, SourceQueue[D]]

override def onPush(): Unit = {
val msg = grab(in)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ class PostgresDatabase(postgres: PostgresService) extends Database {

override def execute(ctxt: EvalContext, expr: DataExpr): List[TimeSeries] = {
val exactTags = Query.tags(expr.query)
val data = mutable.AnyRefMap.empty[Map[String, String], TimeSeriesBuffer]
val data = mutable.HashMap.empty[Map[String, String], TimeSeriesBuffer]
postgres.runQueries { stmt =>
overlappingTimes(stmt, ctxt).foreach { t =>
val block = ArrayBlock(t.toEpochMilli, blockSize)
Expand Down
2 changes: 1 addition & 1 deletion project/Dependencies.scala
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ object Dependencies {
val iep = "5.0.30"
val jackson = "2.18.2"
val log4j = "2.24.3"
val scala = "2.13.15"
val scala = "2.13.16"
val slf4j = "2.0.16"
val spectator = "1.8.4"
val spring = "6.1.16"
Expand Down

0 comments on commit 7759930

Please sign in to comment.