Skip to content

Commit 3a1b361

Browse files
authored
Merge pull request #6 from AVSystem/jdk-25-compat
JDK 17+ compatibility: JCTools 4.x, suppress deprecation warnings, expand CI matrix
2 parents 2a585b7 + 6e8a400 commit 3a1b361

8 files changed

Lines changed: 31 additions & 12 deletions

File tree

.github/workflows/build.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ jobs:
1414
strategy:
1515
fail-fast: false
1616
matrix:
17-
java: [ 11 ]
17+
java: [ 11, 17, 21, 25 ]
1818
# WARN: build.sbt depends on this key path, as scalaVersion and
1919
# crossScalaVersions is determined from it
2020
scala: [ 2.13.18, 3.3.7 ]

build.sbt

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
1+
import MonixBuildUtils.*
2+
import org.typelevel.scalacoptions.ScalacOptions
13
import sbt.Keys.version
2-
import sbt.{ Def, Global, Tags }
4+
import sbt.{Def, Global, Tags}
35

46
import scala.collection.immutable.SortedSet
5-
import MonixBuildUtils._
6-
import org.typelevel.scalacoptions.ScalacOptions
77

88
val benchmarkProjects = List(
99
"benchmarksPrev",
@@ -27,7 +27,7 @@ addCommandAlias("ci-release", ";+publishSigned ;sonatypeBundleRelease")
2727
val cats_Version = "2.7.0"
2828
val catsEffect_Version = "2.5.5"
2929
val fs2_Version = "2.5.11"
30-
val jcTools_Version = "3.3.0"
30+
val jcTools_Version = "4.0.5"
3131
val reactiveStreams_Version = "1.0.4"
3232
val macrotaskExecutor_Version = "1.0.0"
3333
val minitest_Version = "2.9.6"
@@ -191,7 +191,7 @@ lazy val sharedSettings = pgpSettings ++ Seq(
191191
"-Ywarn-unused:params",
192192
"-Wunused:params",
193193
"-Xlint:infer-any",
194-
"-Wnonunit-statement"
194+
"-Wnonunit-statement",
195195
),
196196
// Disabled from tpolecat for test compilation:
197197
// -Wunused:patvars triggers on for-comprehension loop vars in tests (pre-existing pattern)
@@ -205,6 +205,8 @@ lazy val sharedSettings = pgpSettings ++ Seq(
205205
},
206206
// Turning off fatal warnings for doc generation
207207
Compile / doc / tpolecatExcludeOptions ++= ScalacOptions.defaultConsoleExclude,
208+
// Silence "unused @nowarn" —Thread#getId on JDK11
209+
Compile / scalacOptions ++= Seq("-Wconf:cat=unused-nowarn:s"),
208210
// Silence everything in auto-generated files
209211
scalacOptions ++= {
210212
if (isDotty.value)

monix-execution/jvm/src/main/scala/monix/execution/internal/Platform.scala

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,8 @@
1818
package monix.execution.internal
1919

2020
import monix.execution.schedulers.CanBlock
21+
22+
import scala.annotation.nowarn
2123
import scala.concurrent.{Await, Awaitable}
2224
import scala.concurrent.duration.Duration
2325
import scala.util.Try
@@ -175,6 +177,7 @@ private[monix] object Platform {
175177
* To be used for multi-threading optimizations. Note that
176178
* in JavaScript this always returns the same value.
177179
*/
180+
@nowarn("msg=deprecated")
178181
def currentThreadId(): Long = {
179182
Thread.currentThread().getId
180183
}

monix-execution/jvm/src/main/scala/monix/execution/internal/collection/queues/FromCircularQueue.scala

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,8 @@ import monix.execution.internal.atomic.UnsafeAccess
2323
import monix.execution.internal.collection.LowLevelConcurrentQueue
2424
import monix.execution.internal.jctools.queues.MessagePassingQueue
2525
import sun.misc.Unsafe
26+
27+
import scala.annotation.nowarn
2628
import scala.collection.mutable
2729

2830
private[internal] abstract class FromCircularQueue[A](queue: MessagePassingQueue[A])
@@ -50,6 +52,7 @@ private[internal] abstract class FromCircularQueue[A](queue: MessagePassingQueue
5052
}
5153
}
5254

55+
@nowarn("msg=deprecated")
5356
private[internal] object FromCircularQueue {
5457
/**
5558
* Builds a [[FromCircularQueue]] instance.

monix-execution/jvm/src/main/scala/monix/execution/internal/collection/queues/FromMessagePassingQueue.scala

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,8 @@ import monix.execution.internal.atomic.UnsafeAccess
2323
import monix.execution.internal.collection.LowLevelConcurrentQueue
2424
import monix.execution.internal.jctools.queues.MessagePassingQueue
2525
import sun.misc.Unsafe
26+
27+
import scala.annotation.nowarn
2628
import scala.collection.mutable
2729

2830
private[internal] abstract class FromMessagePassingQueue[A](queue: MessagePassingQueue[A])
@@ -47,6 +49,7 @@ private[internal] abstract class FromMessagePassingQueue[A](queue: MessagePassin
4749
}
4850
}
4951

52+
@nowarn("msg=deprecated")
5053
private[internal] object FromMessagePassingQueue {
5154
/**
5255
* Builds a [[FromMessagePassingQueue]] instance.

monix-execution/jvm/src/main/scala/monix/execution/internal/forkJoin/DynamicWorkerThreadFactory.scala

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,20 +19,21 @@ package monix.execution.internal.forkJoin
1919

2020
import java.util.concurrent.ForkJoinPool.{ForkJoinWorkerThreadFactory, ManagedBlocker}
2121
import java.util.concurrent.{ForkJoinPool, ForkJoinWorkerThread, ThreadFactory}
22-
2322
import monix.execution.internal.forkJoin.DynamicWorkerThreadFactory.EmptyBlockContext
2423

24+
import scala.annotation.nowarn
2525
import scala.concurrent.{BlockContext, CanAwait}
2626

2727
// Implement BlockContext on FJP threads
2828
private[monix] final class DynamicWorkerThreadFactory(
2929
prefix: String,
3030
uncaught: Thread.UncaughtExceptionHandler,
31-
daemonic: Boolean)
32-
extends ThreadFactory with ForkJoinWorkerThreadFactory {
31+
daemonic: Boolean
32+
) extends ThreadFactory with ForkJoinWorkerThreadFactory {
3333

3434
require(prefix ne null, "DefaultWorkerThreadFactory.prefix must be non null")
3535

36+
@nowarn("msg=deprecated")
3637
def wire[T <: Thread](thread: T): T = {
3738
thread.setDaemon(daemonic)
3839
thread.setUncaughtExceptionHandler(uncaught)

monix-execution/jvm/src/main/scala/monix/execution/internal/forkJoin/StandardWorkerThreadFactory.scala

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,12 +20,15 @@ package monix.execution.internal.forkJoin
2020
import java.util.concurrent.ForkJoinPool.ForkJoinWorkerThreadFactory
2121
import java.util.concurrent.{ForkJoinPool, ForkJoinWorkerThread, ThreadFactory}
2222

23+
import scala.annotation.nowarn
24+
2325
private[monix] final class StandardWorkerThreadFactory(
2426
prefix: String,
2527
uncaught: Thread.UncaughtExceptionHandler,
26-
daemonic: Boolean)
27-
extends ThreadFactory with ForkJoinWorkerThreadFactory {
28+
daemonic: Boolean
29+
) extends ThreadFactory with ForkJoinWorkerThreadFactory {
2830

31+
@nowarn("msg=deprecated")
2932
def wire[T <: Thread](thread: T): T = {
3033
thread.setDaemon(daemonic)
3134
thread.setUncaughtExceptionHandler(uncaught)

monix-execution/jvm/src/main/scala/monix/execution/schedulers/ThreadFactoryBuilder.scala

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,9 +17,11 @@
1717

1818
package monix.execution.schedulers
1919

20-
import java.util.concurrent.ThreadFactory
2120
import monix.execution.UncaughtExceptionReporter
2221

22+
import java.util.concurrent.ThreadFactory
23+
import scala.annotation.nowarn
24+
2325
private[schedulers] object ThreadFactoryBuilder {
2426
/** Constructs a ThreadFactory using the provided name prefix and appending
2527
* with a unique incrementing thread identifier.
@@ -28,8 +30,10 @@ private[schedulers] object ThreadFactoryBuilder {
2830
* @param daemonic specifies whether the created threads should be daemonic
2931
* (non-daemonic threads are blocking the JVM process on exit).
3032
*/
33+
3134
def apply(name: String, reporter: UncaughtExceptionReporter, daemonic: Boolean): ThreadFactory = {
3235
new ThreadFactory {
36+
@nowarn("msg=deprecated")
3337
def newThread(r: Runnable) = {
3438
val thread = new Thread(r)
3539
thread.setName(name + "-" + thread.getId)

0 commit comments

Comments
 (0)