Skip to content

Commit a6a3385

Browse files
authored
Thread.getId is deprecated (#16142)
Build under JDK19.
2 parents 5d1497d + 55ed6fa commit a6a3385

File tree

2 files changed

+7
-4
lines changed

2 files changed

+7
-4
lines changed

compiler/src/dotty/tools/dotc/profile/Profiler.scala

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -103,6 +103,7 @@ private [profile] class RealProfiler(reporter : ProfileReporter)(using Context)
103103

104104
private val mainThread = Thread.currentThread()
105105

106+
@nowarn("cat=deprecation")
106107
private[profile] def snapThread(idleTimeNanos: Long): ProfileSnap = {
107108
import RealProfiler._
108109
val current = Thread.currentThread()
@@ -245,6 +246,7 @@ class StreamProfileReporter(out:PrintWriter) extends ProfileReporter {
245246
reportCommon(EventType.BACKGROUND, profiler, threadRange)
246247
override def reportForeground(profiler: RealProfiler, threadRange: ProfileRange): Unit =
247248
reportCommon(EventType.MAIN, profiler, threadRange)
249+
@nowarn("cat=deprecation")
248250
private def reportCommon(tpe:EventType, profiler: RealProfiler, threadRange: ProfileRange): Unit =
249251
out.println(s"$tpe,${threadRange.start.snapTimeNanos},${threadRange.end.snapTimeNanos},${profiler.id},${threadRange.phase.id},${threadRange.phase.phaseName.replace(',', ' ')},${threadRange.purpose},${threadRange.taskCount},${threadRange.thread.getId},${threadRange.thread.getName},${threadRange.runNs},${threadRange.idleNs},${threadRange.cpuNs},${threadRange.userNs},${threadRange.allocatedBytes},${threadRange.end.heapBytes} ")
250252

library/src/scala/runtime/coverage/Invoker.scala

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
package scala.runtime.coverage
22

3-
import scala.collection.mutable.{BitSet, AnyRefMap}
3+
import scala.annotation.internal.sharable
4+
import scala.annotation.nowarn
45
import scala.collection.concurrent.TrieMap
6+
import scala.collection.mutable.{BitSet, AnyRefMap}
7+
import java.io.{File, FileWriter}
58
import java.nio.file.Files
6-
import java.io.FileWriter
7-
import java.io.File
8-
import scala.annotation.internal.sharable
99

1010
@sharable // avoids false positive by -Ycheck-reentrant
1111
object Invoker {
@@ -48,6 +48,7 @@ object Invoker {
4848
writer.write('\n')
4949
writer.flush()
5050

51+
@nowarn("cat=deprecation")
5152
def measurementFile(dataDir: String): File = new File(
5253
dataDir,
5354
MeasurementsPrefix + runtimeUUID + "." + Thread.currentThread.nn.getId

0 commit comments

Comments
 (0)