Skip to content

Commit bf107cc

Browse files
committed
util-tunable: Scala 3 support
1 parent 1904b60 commit bf107cc

File tree

2 files changed

+5
-4
lines changed

2 files changed

+5
-4
lines changed

build.sbt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ val defaultScalaSettings = Seq(
8989
)
9090
val defaultScala3EnabledSettings = Seq(
9191
scalaVersion := _scalaVersion,
92-
crossScalaVersions := _crossScalaVersions ++ Seq("3.0.2")
92+
crossScalaVersions := _crossScalaVersions ++ Seq("3.2.2")
9393
)
9494

9595
// Our dependencies or compiler options may differ for both Scala 2 and 3. We branch here
@@ -678,7 +678,7 @@ lazy val utilTunable = Project(
678678
id = "util-tunable",
679679
base = file("util-tunable")
680680
).settings(
681-
sharedSettings
681+
sharedScala3EnabledSettings
682682
).settings(
683683
name := "util-tunable",
684684
libraryDependencies ++= Seq(

util-tunable/src/main/scala/com/twitter/util/tunable/TunableMap.scala

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ import java.util.function.BiFunction
55
import scala.annotation.varargs
66
import scala.collection.mutable
77
import scala.jdk.CollectionConverters._
8+
import scala.reflect.ClassTag
89

910
/**
1011
* A Map that can be used to access [[Tunable]]s using [[TunableMap.Key]]s.
@@ -133,7 +134,7 @@ object TunableMap {
133134
}
134135

135136
object Key {
136-
def apply[T](id: String)(implicit m: Manifest[T]): Key[T] =
137+
def apply[T](id: String)(implicit m: ClassTag[T]): Key[T] =
137138
Key[T](id, m.runtimeClass.asInstanceOf[Class[T]])
138139
}
139140

@@ -199,7 +200,7 @@ object TunableMap {
199200
* Put a [[Tunable]] with id `id` and value `value` into the [[TunableMap]]. If the [[Tunable]]
200201
* for that `id` already exists, update the value to `value`.
201202
*/
202-
final def put[T](id: String, value: T)(implicit m: Manifest[T]): Key[T] =
203+
final def put[T](id: String, value: T)(implicit m: ClassTag[T]): Key[T] =
203204
put[T](id, m.runtimeClass.asInstanceOf[Class[T]], value)
204205

205206
/**

0 commit comments

Comments
 (0)