Skip to content

Commit f46737e

Browse files
[compiler] misc scala 2.13 deprecation fixes (#15137)
## Change Description The changes are summarized by the removed warning silencers in `build.mill`​. ## Security Assessment - This change cannot impact the Hail Batch instance as deployed by Broad Institute in GCP
1 parent 3a18fca commit f46737e

49 files changed

Lines changed: 122 additions & 206 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

‎hail/build.mill‎

Lines changed: 0 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -147,27 +147,6 @@ trait HailModule extends ScalaModule with ScalafmtModule with ScalafixModule { o
147147
if (scalaVersion().startsWith("2.13")) {
148148
finalOptions ++
149149
Seq(
150-
// collection types
151-
// type Traversable in package scala is deprecated (since 2.13.0): Use Iterable instead of Traversable
152-
"-Wconf:cat=deprecation&msg=type Traversable in package scala is deprecated:s",
153-
// type TraversableOnce in package scala is deprecated (since 2.13.0): Use IterableOnce instead of TraversableOnce
154-
"-Wconf:cat=deprecation&msg=type TraversableOnce:s",
155-
// type BufferedIterator in package scala is deprecated (since 2.13.0): Use scala.collection.BufferedIterator instead of scala.BufferedIterator
156-
"-Wconf:cat=deprecation&msg=type BufferedIterator in package scala is deprecated:s",
157-
// class Stream in package immutable is deprecated (since 2.13.0): Use LazyList (which is fully lazy) instead of Stream (which has a lazy tail only)
158-
"-Wconf:cat=deprecation&msg=Stream:s",
159-
// type Growable in package generic is deprecated (since 2.13.0): Growable was moved from collection.generic to collection.mutable
160-
"-Wconf:cat=deprecation&msg=type Growable in package generic is deprecated:s",
161-
// type GenTraversableOnce in package collection is deprecated (since 2.13.0): Gen* collection types have been removed
162-
"-Wconf:cat=deprecation&msg=type GenTraversableOnce in package collection is deprecated:s",
163-
// trait MultiMap in package mutable is deprecated (since 2.13.0): Use a scala.collection.mutable.MultiDict in the scala-collection-contrib module
164-
"-Wconf:cat=deprecation&msg=trait MultiMap in package mutable is deprecated:s",
165-
// inheritance from class HashMap in package mutable is deprecated (since 2.13.0): HashMap will be made final; use .withDefault for the common use case of computing a default value
166-
"-Wconf:cat=deprecation&msg=inheritance from class HashMap in package mutable is deprecated:s",
167-
// object JavaConverters in package collection is deprecated (since 2.13.0): Use `scala.jdk.CollectionConverters` instead
168-
"-Wconf:cat=deprecation&msg=object JavaConverters in package collection is deprecated:s",
169-
// object ImplicitConversions in package convert is deprecated (since 2.13.0): Use `scala.jdk.CollectionConverters` instead
170-
"-Wconf:cat=deprecation&msg=object ImplicitConversions in package convert is deprecated:s",
171150
// generic to immutable default
172151
// collection methods
173152
// method copyArrayToImmutableIndexedSeq in class LowPriorityImplicits2 is deprecated (since 2.13.0): implicit conversions from Array to immutable.IndexedSeq are implemented by copying; use `toIndexedSeq` explicitly if you want to copy, or use the more efficient non-copying ArraySeq.unsafeWrapArray
@@ -321,7 +300,6 @@ trait RootHailModule extends CrossScalaModule with HailModule { outer =>
321300
Rule.Exclude("META-INF/INDEX.LIST"),
322301
Rule.ExcludePattern("scala/(?!collection/compat).*"),
323302
Rule.AppendPattern("META-INF/services/.*", "\n"),
324-
// Rule.Relocate("scala.collection.compat.**", "is.hail.relocated.@0"),
325303
Rule.Relocate("breeze.**", "is.hail.relocated.@0"),
326304
Rule.Relocate("com.google.cloud.**", "is.hail.relocated.@0"),
327305
Rule.Relocate("com.google.common.**", "is.hail.relocated.@0"),

‎hail/hail/src-2.12/is/hail/utils/compat/ShrinkableCompat.scala‎

Lines changed: 0 additions & 8 deletions
This file was deleted.

hail/hail/src-2.12/is/hail/utils/compat/GrowableCompat.scala renamed to hail/hail/src-2.12/is/hail/utils/compat/mutable/GrowableCompat.scala

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
1-
package is.hail.utils.compat
1+
package is.hail.utils.compat.mutable
22

3-
import scala.collection.generic.Growable
3+
import scala.collection.generic
44

5-
trait GrowableCompat[-A] extends Growable[A] {
5+
trait Growable[-A] extends generic.Growable[A] {
66
override def +=(elem: A): this.type = addOne(elem)
77
protected def addOne(elem: A): this.type
88
def knownSize: Int = -1
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
package is.hail.utils.compat.mutable
2+
3+
import scala.collection.generic
4+
5+
trait Shrinkable[-A] extends generic.Shrinkable[A] {
6+
override def -=(elem: A): this.type = subtractOne(elem)
7+
protected def subtractOne(elem: A): this.type
8+
}

‎hail/hail/src-2.13/is/hail/utils/compat/immutable/package.scala‎

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,5 @@ package is.hail.utils.compat
22

33
package object immutable {
44
type ArraySeq[+A] = scala.collection.immutable.ArraySeq[A]
5-
6-
val ArraySeq: scala.collection.compat.immutable.ArraySeq.type =
7-
scala.collection.compat.immutable.ArraySeq
5+
val ArraySeq = scala.collection.immutable.ArraySeq
86
}
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
package is.hail.utils.compat
2+
3+
package object mutable {
4+
type Growable[-A] = scala.collection.mutable.Growable[A]
5+
type Shrinkable[-A] = scala.collection.mutable.Shrinkable[A]
6+
}

‎hail/hail/src-2.13/is/hail/utils/compat/package.scala‎

Lines changed: 0 additions & 8 deletions
This file was deleted.

‎hail/hail/src/is/hail/annotations/OrderedRVIterator.scala‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,8 @@ import is.hail.backend.HailStateManager
44
import is.hail.rvd.{RVDContext, RVDType}
55
import is.hail.types.physical.PInterval
66
import is.hail.utils._
7+
import is.hail.utils.compat.mutable.Growable
78

8-
import scala.collection.generic.Growable
99
import scala.collection.mutable
1010

1111
object OrderedRVIterator {

‎hail/hail/src/is/hail/annotations/WritableRegionValue.scala‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ package is.hail.annotations
33
import is.hail.backend.HailStateManager
44
import is.hail.rvd.RVDContext
55
import is.hail.types.physical.{PStruct, PType}
6-
import is.hail.utils.compat.GrowableCompat
6+
import is.hail.utils.compat.mutable.Growable
77

88
import scala.collection.mutable.{ArrayBuffer, PriorityQueue}
99

@@ -129,7 +129,7 @@ class RegionValuePriorityQueue(
129129
}
130130

131131
class RegionValueArrayBuffer(val t: PType, region: Region, sm: HailStateManager)
132-
extends Iterable[RegionValue] with GrowableCompat[RegionValue] {
132+
extends Iterable[RegionValue] with Growable[RegionValue] {
133133

134134
val value = RegionValue(region, 0)
135135

‎hail/hail/src/is/hail/backend/service/ServiceBackend.scala‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -257,7 +257,7 @@ class ServiceBackend(
257257
val (failures, successes) =
258258
Await.result(
259259
Future
260-
.traverse(failedJobs.map(_.take(1)) append succeededJobs) { jobs =>
260+
.traverse(failedJobs.map(_.take(1)) lazyAppendedAll succeededJobs) { jobs =>
261261
readPartitionOutputs(jobs.map(_.job_id - startJobId))
262262
},
263263
Duration.Inf,

0 commit comments

Comments
 (0)