Skip to content
Merged
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 .scala-steward.conf
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
updates.pin = [
{groupId = "org.scala-lang", artifactId = "scala3-library", version = "3.3."},
{groupId = "org.scala-lang", artifactId = "scala3-library_sjs1", version = "3.3."},
{groupId = "org.scala-lang", artifactId = "scala3-library", version = "3.9."},
{groupId = "org.scala-lang", artifactId = "scala3-library_sjs1", version = "3.9."},
{groupId = "org.scala-lang", artifactId = "scala-library", version = "2.13."}
]
5 changes: 3 additions & 2 deletions build.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import com.softwaremill.Publish.ossPublishSettings
val scala2_12 = "2.12.19"
val scala2_13 = "2.13.18"
val scala2 = List(scala2_12, scala2_13)
val scala3 = List("3.3.3")
val scala3 = List("3.9.0")

val scalatestVersion = "3.2.19"

Expand All @@ -17,7 +17,8 @@ organization := "com.softwaremill.odelay"
licenses := Seq(License("MIT", url(s"https://github.com/softprops/odelay/blob/${version.value}/LICENSE")))

val commonJvmSettings = Seq(
scalacOptions ++= (if (ScalaArtifacts.isScala3(scalaVersion.value)) Seq.empty else Seq("-release", "8")),
scalacOptions ++= (if (ScalaArtifacts.isScala3(scalaVersion.value)) Seq.empty
else Seq("-release", "8", "-Xsource:3")),
ideSkipProject := (scalaVersion.value != scala2_13)
)

Expand Down
1 change: 1 addition & 0 deletions odelay-core/src/main/scalajs/JsTimer.scala
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ class JsTimer() extends Timer {
}

def cancel(): Unit = {
clearTimeout(initclearable)
if (clearable != null) clearInterval(clearable)
cancelPromise()
}
Expand Down
4 changes: 2 additions & 2 deletions odelay-core/src/main/scalajvm/jdk/JdkTimer.scala
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ class JdkTimer(underlying: ScheduledExecutorService, interruptOnCancel: Boolean)

def apply[T](delay: FiniteDuration, op: => T): Delay[T] =
new PromisingDelay[T] {
val jfuture: Option[JFuture[_]] =
val jfuture: Option[JFuture[?]] =
try {
Some(
underlying.schedule(
Expand All @@ -57,7 +57,7 @@ class JdkTimer(underlying: ScheduledExecutorService, interruptOnCancel: Boolean)

def apply[T](delay: FiniteDuration, every: FiniteDuration, op: => T): PeriodicDelay[T] =
new PeriodicPromisingDelay[T](every) {
val jfuture: Option[JFuture[_]] =
val jfuture: Option[JFuture[?]] =
try {
Some(
underlying.scheduleWithFixedDelay(
Expand Down
4 changes: 2 additions & 2 deletions odelay-netty/src/main/scala/NettyTimer.scala
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ class NettyGroupTimer(grp: EventExecutorGroup, interruptOnCancel: Boolean = Nett

def apply[T](delay: FiniteDuration, op: => T): Delay[T] =
new PromisingDelay[T] {
val sf: Option[NFuture[_]] =
val sf: Option[NFuture[?]] =
try {
Some(
grp.schedule(
Expand All @@ -38,7 +38,7 @@ class NettyGroupTimer(grp: EventExecutorGroup, interruptOnCancel: Boolean = Nett

def apply[T](delay: FiniteDuration, every: FiniteDuration, op: => T): PeriodicDelay[T] =
new PeriodicPromisingDelay[T](every) {
val sf: Option[NFuture[_]] =
val sf: Option[NFuture[?]] =
try {
Some(
grp.scheduleWithFixedDelay(
Expand Down
2 changes: 1 addition & 1 deletion odelay-netty/src/test/scala/NettyGroupTimerSpec.scala
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,6 @@ package odelay.netty
import io.netty.util.concurrent.DefaultEventExecutorGroup

class NettyGroupTimerSpec extends odelay.testing.TimerSpec {
def newTimer = NettyTimer.groupTimer(new DefaultEventExecutorGroup(1))
def newTimer: odelay.Timer = NettyTimer.groupTimer(new DefaultEventExecutorGroup(1))
def timerName = "NettyGroupTimer"
}
6 changes: 3 additions & 3 deletions odelay-testing/src/test/scalajs/TimerSpec.scala
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ class TimerSpec extends AsyncFunSpec with BeforeAndAfterAll {
cancel.cancel()
}
cancel.future.recover {
case x: CancellationException => succeed
case _: CancellationException => succeed
case _ => fail()
}
}
Expand All @@ -63,10 +63,10 @@ class TimerSpec extends AsyncFunSpec with BeforeAndAfterAll {
it("successful completion of delayed operations should result in a future failure") {
case object CustomException extends Exception

val future = Delay(1.second)(throw CustomException).future
val future = Delay[Unit](1.second)(throw CustomException).future
future.transformWith {
case Failure(exception) => assert(exception === CustomException)
case _ => fail("The delayed future was expected to fail")
case _ => fail("The delayed future was expected to fail")
}
}

Expand Down
6 changes: 3 additions & 3 deletions odelay-testing/src/test/scalajvm/TimerSpec.scala
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ trait TimerSpec extends AsyncFunSpec with BeforeAndAfterAll {
cancel.cancel()
}
for {
cf <- cancelF.future
_ <- cancelF.future
c <- cancel.future.failed
} yield {
assert(c.getClass === classOf[CancellationException])
Expand All @@ -54,7 +54,7 @@ trait TimerSpec extends AsyncFunSpec with BeforeAndAfterAll {
it("unsuccessful completion of delayed operations should result in a future failure") {
case object CustomException extends Exception

val future = Delay(1.second)(throw CustomException).future
val future = Delay[Unit](1.second)(throw CustomException).future
future.transformWith {
case Failure(exception) => assert(exception === CustomException)
case _ => fail("The delayed future was expected to fail")
Expand All @@ -78,7 +78,7 @@ trait TimerSpec extends AsyncFunSpec with BeforeAndAfterAll {
val counter = new AtomicInteger(0)
val cancel = Delay.every(150.seconds)()(true)
val cancelFut = cancel.future.recoverWith {
case e: CancellationException =>
case _: CancellationException =>
counter.incrementAndGet()
Future.successful(true)
case _ => Future.successful(true)
Expand Down
Loading