Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

support scala 3 build for util-tunable #305

Open
wants to merge 1 commit into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions build.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ val defaultScalaSettings = Seq(
)
val defaultScala3EnabledSettings = Seq(
scalaVersion := _scalaVersion,
crossScalaVersions := _crossScalaVersions ++ Seq("3.0.2")
crossScalaVersions := _crossScalaVersions ++ Seq("3.2.2")
)

// Our dependencies or compiler options may differ for both Scala 2 and 3. We branch here
Expand Down Expand Up @@ -678,7 +678,7 @@ lazy val utilTunable = Project(
id = "util-tunable",
base = file("util-tunable")
).settings(
sharedSettings
sharedScala3EnabledSettings
).settings(
name := "util-tunable",
libraryDependencies ++= Seq(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import java.util.function.BiFunction
import scala.annotation.varargs
import scala.collection.mutable
import scala.jdk.CollectionConverters._
import scala.reflect.ClassTag

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

object Key {
def apply[T](id: String)(implicit m: Manifest[T]): Key[T] =
def apply[T](id: String)(implicit m: ClassTag[T]): Key[T] =
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Manifest no longer exists in Scala 3 and there is no equivalent replacement.

Since it is only used to retrieve the runtime class (which is erased anyway), ClassTag should work the same way here, as far as I understand it.

Key[T](id, m.runtimeClass.asInstanceOf[Class[T]])
}

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

/**
Expand Down