Skip to content

Commit 17209a4

Browse files
committed
address more comments
1 parent 58de8f0 commit 17209a4

File tree

4 files changed

+36
-9
lines changed

4 files changed

+36
-9
lines changed

kernel-laws/jvm/src/test/scala/cats/kernel/laws/JvmLawTests.scala

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ package laws
2525
import cats.kernel.compat.scalaVersionSpecific.*
2626
import cats.kernel.instances.currency.*
2727
import cats.kernel.laws.discipline.*
28+
import cats.kernel.laws.scalaVersionSpecific.*
2829
import munit.DisciplineSuite
2930
import java.util.Currency
3031
import org.scalacheck.{Arbitrary, Cogen, Gen}
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
/*
2+
* Copyright (c) 2015 Typelevel
3+
*
4+
* Permission is hereby granted, free of charge, to any person obtaining a copy of
5+
* this software and associated documentation files (the "Software"), to deal in
6+
* the Software without restriction, including without limitation the rights to
7+
* use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
8+
* the Software, and to permit persons to whom the Software is furnished to do so,
9+
* subject to the following conditions:
10+
*
11+
* The above copyright notice and this permission notice shall be included in all
12+
* copies or substantial portions of the Software.
13+
*
14+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15+
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
16+
* FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
17+
* COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
18+
* IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
19+
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
20+
*/
21+
22+
package cats.kernel.laws
23+
import scala.annotation.{Annotation, StaticAnnotation}
24+
import scala.collection.{mutable, IterableLike, TraversableLike}
25+
import scala.collection.JavaConverters._
26+
27+
private[cats] object scalaVersionSpecific {
28+
29+
implicit class iterableExtension[A](private val s: java.lang.Iterable[A]) extends AnyVal {
30+
def asScala: Iterable[A] = iterableAsScalaIterable(s)
31+
}
32+
}

kernel/src/main/scala-2.12/cats/kernel/compat/scalaVersionSpecific.scala

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,7 @@
2121

2222
package cats.kernel.compat
2323
import scala.annotation.{Annotation, StaticAnnotation}
24-
import scala.collection.{mutable, IterableLike, TraversableLike}
25-
import scala.collection.convert.ImplicitConversionsToScala.*
24+
import scala.collection.{IterableLike, TraversableLike}
2625

2726
private[cats] object scalaVersionSpecific {
2827

@@ -51,8 +50,4 @@ private[cats] object scalaVersionSpecific {
5150
that: T
5251
)(implicit w1: A => TraversableLike[El1, Repr1], w2: T => IterableLike[El2, Repr2]) = (a, that).zipped
5352
}
54-
55-
implicit class setExtension[A](private val s: java.util.Set[A]) extends AnyVal {
56-
def asScala: mutable.Set[A] = `set asScala`(s)
57-
}
5853
}

kernel/src/main/scala-2.13+/cats/kernel/compat/scalaVersionSpecific.scala

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,7 @@ package kernel
2424

2525
package compat
2626
import scala.annotation.{Annotation, StaticAnnotation}
27-
import scala.collection.mutable
28-
import scala.jdk.CollectionConverters.*
27+
import scala.jdk.javaapi.CollectionConverters
2928

3029
private[cats] object scalaVersionSpecific {
3130

@@ -39,6 +38,6 @@ private[cats] object scalaVersionSpecific {
3938
}
4039

4140
implicit class setExtension[A](private val s: java.util.Set[A]) extends AnyVal {
42-
def asScala: mutable.Set[A] = SetHasAsScala(s).asScala
41+
def asScala: Iterable[A] = CollectionConverters.asScala(x)
4342
}
4443
}

0 commit comments

Comments
 (0)