Thanks to visit codestin.com
Credit goes to github.com

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
14 changes: 7 additions & 7 deletions build.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -214,7 +214,12 @@ lazy val core = crossProject(JSPlatform, JVMPlatform, NativePlatform)
.settings(stdSettings("zio"))
.settings(crossProjectSettings)
.settings(buildInfoSettings("zio"))
.settings(libraryDependencies += "dev.zio" %%% "izumi-reflect" % IzumiReflectVersion)
.settings(
libraryDependencies ++= List(
"dev.zio" %%% "izumi-reflect" % IzumiReflectVersion,
"org.scala-lang.modules" %%% "scala-collection-compat" % ScalaCollectionCompatVersion
)
)
.enablePlugins(BuildInfoPlugin)
.settings(macroDefinitionSettings)
.settings(scalacOptions += "-Wconf:msg=[zio.stacktracer.TracingImplicits.disableAutoTrace]:silent")
Expand Down Expand Up @@ -568,12 +573,7 @@ lazy val testJunitRunnerTests = project.module
lazy val testJunitEngine = project.module
.in(file("test-junit-engine"))
.settings(stdSettings("zio-test-junit-engine"))
.settings(
libraryDependencies ++= Seq(
"org.junit.platform" % "junit-platform-engine" % JunitPlatformEngineVersion,
"org.scala-lang.modules" %% "scala-collection-compat" % ScalaCollectionCompatVersion
)
)
.settings(libraryDependencies += "org.junit.platform" % "junit-platform-engine" % JunitPlatformEngineVersion)
.dependsOn(tests.jvm)

lazy val testJunitEngineTests = project.module
Expand Down
6 changes: 2 additions & 4 deletions concurrent/src/main/scala/zio/concurrent/ConcurrentMap.scala
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,8 @@ package zio.concurrent
import zio.{Chunk, ChunkBuilder, UIO, ZIO}

import java.util.concurrent.ConcurrentHashMap

import java.util.function.BiConsumer
import scala.annotation.nowarn
import scala.collection.JavaConverters._
import scala.jdk.CollectionConverters._

/**
* Wrapper over `java.util.concurrent.ConcurrentHashMap`.
Expand Down Expand Up @@ -111,7 +109,7 @@ final class ConcurrentMap[K, V] private (private val underlying: ConcurrentHashM
* Adds all new key-value pairs
*/
def putAll(keyValues: (K, V)*): UIO[Unit] =
ZIO.succeed(underlying.putAll(keyValues.toMap.asJava): @nowarn("msg=JavaConverters"))
ZIO.succeed(underlying.putAll(keyValues.toMap.asJava))

/**
* Adds a new key-value pair, unless the key is already bound to some other
Expand Down
12 changes: 5 additions & 7 deletions concurrent/src/main/scala/zio/concurrent/ConcurrentSet.scala
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,7 @@ import zio.{UIO, ZIO}

import java.util.concurrent.ConcurrentHashMap
import java.util.function.{Consumer, Predicate}
import scala.annotation.nowarn
import scala.collection.JavaConverters._
import scala.jdk.CollectionConverters._

/**
* A `ConcurrentSet` is a Set wrapper over
Expand All @@ -24,7 +23,7 @@ final class ConcurrentSet[A] private (private val underlying: ConcurrentHashMap.
* Adds all new values.
*/
def addAll(xs: Iterable[A]): UIO[Boolean] =
ZIO.succeed(underlying.addAll(xs.asJavaCollection): @nowarn("msg=JavaConverters"))
ZIO.succeed(underlying.addAll(xs.asJavaCollection))

/**
* Removes all elements.
Expand Down Expand Up @@ -139,7 +138,7 @@ final class ConcurrentSet[A] private (private val underlying: ConcurrentHashMap.
* existing element.
*/
def removeAll(xs: Iterable[A]): UIO[Boolean] =
ZIO.succeed(underlying.removeAll(xs.asJavaCollection): @nowarn("msg=JavaConverters"))
ZIO.succeed(underlying.removeAll(xs.asJavaCollection))

/**
* Removes all elements which satisfy the given predicate.
Expand All @@ -152,7 +151,7 @@ final class ConcurrentSet[A] private (private val underlying: ConcurrentHashMap.
* existing element.
*/
def retainAll(xs: Iterable[A]): UIO[Boolean] =
ZIO.succeed(underlying.retainAll(xs.asJavaCollection): @nowarn("msg=JavaConverters"))
ZIO.succeed(underlying.retainAll(xs.asJavaCollection))

/**
* Removes all elements which do not satisfy the given predicate.
Expand All @@ -170,12 +169,11 @@ final class ConcurrentSet[A] private (private val underlying: ConcurrentHashMap.
* Convert the ConcurrentSet to Set.
*/
def toSet: UIO[Set[A]] =
ZIO.succeed(underlying.asScala.toSet: @nowarn("msg=JavaConverters"))
ZIO.succeed(underlying.asScala.toSet)

/**
* Transform all elements of the ConcurrentSet using the given function.
*/
@nowarn("msg=JavaConverters")
def transform(f: A => A): UIO[Unit] =
ZIO.succeed {
val set = underlying.asScala.toSet
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,16 +20,14 @@ import zio.internal.stacktracer.Tracer
import zio.stacktracer.TracingImplicits.disableAutoTrace

import java.lang.{System => JSystem}
import scala.annotation.nowarn
import scala.collection.JavaConverters._
import scala.jdk.CollectionConverters._

private[zio] trait SystemPlatformSpecific { self: System.type =>

private[zio] val environmentProvider = new EnvironmentProvider {
override def env(variable: String): Option[String] =
Option(JSystem.getenv(variable))

@nowarn("msg=JavaConverters")
override def envs: Map[String, String] =
JSystem.getenv().asScala.toMap
}
Expand Down
4 changes: 1 addition & 3 deletions core/jvm/src/main/scala/zio/metrics/jvm/BufferPools.scala
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,7 @@ import zio._
import zio.metrics._

import java.lang.management.{BufferPoolMXBean, ManagementFactory}
import scala.annotation.nowarn
import scala.collection.JavaConverters._
import scala.jdk.CollectionConverters._

final case class BufferPools(
bufferPoolUsedBytes: PollingMetric[Any, Throwable, Chunk[MetricState.Gauge]],
Expand All @@ -14,7 +13,6 @@ final case class BufferPools(
)

object BufferPools {
@nowarn("msg=JavaConverters")
val live: ZLayer[JvmMetricsSchedule, Throwable, Reloadable[BufferPools]] =
ZLayer.scoped {
for {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,16 +4,14 @@ import zio._
import zio.metrics._

import java.lang.management.ManagementFactory
import scala.annotation.nowarn
import scala.collection.JavaConverters._
import scala.jdk.CollectionConverters._

final case class GarbageCollector(
gcCollectionSecondsSum: PollingMetric[Any, Throwable, Chunk[MetricState.Gauge]],
gcCollectionSecondsCount: PollingMetric[Any, Throwable, Chunk[MetricState.Gauge]]
)

object GarbageCollector {
@nowarn("msg=JavaConverters")
val live: ZLayer[JvmMetricsSchedule, Throwable, GarbageCollector] =
ZLayer.scoped {
for {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,8 @@ import zio.metrics._
import java.lang.management.{GarbageCollectorMXBean, ManagementFactory}
import javax.management.openmbean.CompositeData
import javax.management.{Notification, NotificationEmitter, NotificationListener}
import scala.annotation.nowarn
import scala.collection.JavaConverters._
import scala.collection.mutable
import scala.jdk.CollectionConverters._

final case class MemoryAllocation(listener: NotificationListener, garbageCollectorMXBeans: List[GarbageCollectorMXBean])

Expand All @@ -26,7 +25,6 @@ object MemoryAllocation {
private class Listener(runtime: Runtime[Any]) extends NotificationListener {
private val lastMemoryUsage: mutable.Map[String, Long] = mutable.HashMap.empty

@nowarn("msg=JavaConverters")
override def handleNotification(notification: Notification, handback: Any): Unit = {
val info =
GarbageCollectionNotificationInfo.from(notification.getUserData.asInstanceOf[CompositeData])
Expand Down Expand Up @@ -72,7 +70,6 @@ object MemoryAllocation {
}
}

@nowarn("msg=JavaConverters")
val live: ZLayer[Any, Throwable, MemoryAllocation] =
ZLayer.scoped {
ZIO
Expand Down
5 changes: 1 addition & 4 deletions core/jvm/src/main/scala/zio/metrics/jvm/MemoryPools.scala
Original file line number Diff line number Diff line change
@@ -1,12 +1,10 @@
package zio.metrics.jvm

import zio._
import zio.metrics.MetricKeyType.Gauge
import zio.metrics._

import java.lang.management.{ManagementFactory, MemoryPoolMXBean, MemoryUsage}
import scala.annotation.nowarn
import scala.collection.JavaConverters._
import scala.jdk.CollectionConverters._

final case class MemoryPools(
memoryBytesUsed: PollingMetric[Any, Throwable, Chunk[MetricState.Gauge]],
Expand Down Expand Up @@ -106,7 +104,6 @@ object MemoryPools {
jvmMemoryPoolInitBytes = "jvm_memory_pool_bytes_init"
)

@nowarn("msg=JavaConverters")
private def withNames(
jvmMemoryCommittedBytes: String,
jvmMemoryInitBytes: String,
Expand Down
4 changes: 1 addition & 3 deletions core/shared/src/main/scala/zio/System.scala
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,7 @@ package zio
import zio.stacktracer.TracingImplicits.disableAutoTrace

import java.lang.{System => JSystem}
import scala.annotation.nowarn
import scala.collection.JavaConverters._
import scala.jdk.CollectionConverters._

trait System extends Serializable { self =>
def env(variable: => String)(implicit trace: Trace): IO[SecurityException, Option[String]]
Expand Down Expand Up @@ -153,7 +152,6 @@ object System extends SystemPlatformSpecific {
override def lineSeparator()(implicit unsafe: Unsafe): String =
JSystem.lineSeparator

@nowarn("msg=JavaConverters")
override def properties()(implicit unsafe: Unsafe): Map[String, String] =
JSystem.getProperties.asScala.toMap

Expand Down
6 changes: 3 additions & 3 deletions core/shared/src/main/scala/zio/ZIO.scala
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ import zio.stacktracer.TracingImplicits.disableAutoTrace
import java.io.IOException
import java.util.concurrent.ConcurrentLinkedQueue
import java.util.function.IntFunction
import scala.annotation.{implicitNotFound, nowarn}
import scala.annotation.implicitNotFound
import scala.collection.mutable.ListBuffer
import scala.concurrent.ExecutionContext
import scala.reflect.ClassTag
Expand Down Expand Up @@ -6308,9 +6308,9 @@ object ZIO extends ZIOCompanionPlatformSpecific with ZIOCompanionVersionSpecific
case 1 => f(as.head).unit
case size =>
ZIO.suspendSucceed {
import scala.collection.JavaConverters._
import scala.jdk.CollectionConverters._

val queue = new ConcurrentLinkedQueue[A](as.asJavaCollection): @nowarn("msg=JavaConverters")
val queue = new ConcurrentLinkedQueue[A](as.asJavaCollection)

lazy val worker: ZIO[R, E, Unit] =
ZIO.suspendSucceed(queue.poll() match {
Expand Down
4 changes: 2 additions & 2 deletions test/shared/src/main/scala/zio/test/Gen.scala
Original file line number Diff line number Diff line change
Expand Up @@ -18,13 +18,13 @@ package zio.test

import zio.Random._
import zio.stacktracer.TracingImplicits.disableAutoTrace
import zio.stream.{Stream, ZStream}
import zio.stream.ZStream
import zio.{Chunk, NonEmptyChunk, Random, Trace, UIO, URIO, ZIO, Zippable}

import java.nio.charset.StandardCharsets
import java.util.UUID
import scala.collection.JavaConverters._
import scala.collection.immutable.SortedMap
import scala.jdk.CollectionConverters._
import scala.math.Numeric.DoubleIsFractional

/**
Expand Down
4 changes: 1 addition & 3 deletions test/shared/src/main/scala/zio/test/TimeVariants.scala
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,7 @@ package zio.test
import zio.{Duration, Trace}

import java.time._
import scala.annotation.nowarn
import scala.collection.JavaConverters._
import scala.jdk.CollectionConverters._

trait TimeVariants {

Expand Down Expand Up @@ -287,7 +286,6 @@ trait TimeVariants {
/**
* A generator of `java.time.ZoneId` values. Doesn't have any shrinking.
*/
@nowarn("msg=JavaConverters")
final def zoneId(implicit trace: Trace): Gen[Any, ZoneId] =
Gen.elements(ZoneId.getAvailableZoneIds.asScala.map(ZoneId.of).toList: _*).noShrink

Expand Down
Loading