Skip to content

Commit ead9591

Browse files
authored
Merge pull request #546 from yadavan88/repo-cleanup
Fixed many of the warnings after scala 2.13 upgrade
2 parents 51ca879 + 321f876 commit ead9591

File tree

42 files changed

+77
-107
lines changed

Some content is hidden

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

42 files changed

+77
-107
lines changed

build.sbt

Lines changed: 21 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -134,12 +134,13 @@ lazy val scala_core_collections = (project in file("scala-core-collections"))
134134
)
135135
)
136136

137-
lazy val scala_core_collections_2 = (project in file("scala-core-collections-2"))
138-
.settings(
139-
name := "scala-core-collections-2",
140-
libraryDependencies +=
141-
"org.scalatest" %% "scalatest" % "3.2.14" % Test
142-
)
137+
lazy val scala_core_collections_2 =
138+
(project in file("scala-core-collections-2"))
139+
.settings(
140+
name := "scala-core-collections-2",
141+
libraryDependencies +=
142+
"org.scalatest" %% "scalatest" % "3.2.14" % Test
143+
)
143144

144145
lazy val scala_test = (project in file("scala-test"))
145146
.settings(
@@ -186,7 +187,6 @@ lazy val scala_akka_2 = (project in file("scala-akka-2"))
186187
.enablePlugins(AkkaGrpcPlugin)
187188
.settings(
188189
name := "scala-akka-2",
189-
scalaVersion := "2.13.10",
190190
libraryDependencies ++= Seq(
191191
"com.typesafe.akka" %% "akka-actor-typed" % "2.6.19",
192192
"com.typesafe.akka" %% "akka-http" % "10.2.10",
@@ -235,9 +235,11 @@ val monixVersion = "3.4.0"
235235
val elastic4sVersion = "7.16.0"
236236
val sparkVersion = "3.2.1"
237237

238+
val sparkCoreDep = "org.apache.spark" %% "spark-core" % sparkVersion
239+
val sparkSqlDep = "org.apache.spark" %% "spark-sql" % sparkVersion
240+
238241
lazy val scala_libraries_2 = (project in file("scala-libraries-2"))
239242
.settings(
240-
scalaVersion := "2.12.15",
241243
name := "scala-libraries",
242244
libraryDependencies += "org.scalatest" %% "scalatest" % "3.1.2" % Test,
243245
libraryDependencies ++= Seq(
@@ -251,23 +253,19 @@ lazy val scala_libraries_2 = (project in file("scala-libraries-2"))
251253
"com.beachape" %% "enumeratum" % "1.7.0"
252254
),
253255
libraryDependencies ++= Seq(
254-
"com.typesafe.play" %% "play-slick" % "5.0.0",
256+
"com.typesafe.play" %% "play-slick" % "5.1.0",
255257
"org.postgresql" % "postgresql" % "42.2.12"
256258
),
257259
libraryDependencies ++= Seq(
258260
"io.monix" %% "monix" % monixVersion
259261
),
260-
libraryDependencies ++= Seq(
261-
"org.apache.spark" %% "spark-core" % sparkVersion,
262-
"org.apache.spark" %% "spark-sql" % sparkVersion
263-
),
264262
dependencyOverrides := Seq(
265-
"com.typesafe.akka" %% "akka-protobuf-v3" % "2.6.16",
266-
"com.typesafe.akka" %% "akka-stream" % "2.6.16",
267-
"com.typesafe.akka" %% "akka-serialization-jackson" % "2.6.16"
263+
"com.typesafe.akka" %% "akka-protobuf-v3" % "2.6.19",
264+
"com.typesafe.akka" %% "akka-stream" % "2.6.19",
265+
"com.typesafe.akka" %% "akka-serialization-jackson" % "2.6.19"
268266
),
269267
libraryDependencies ++= Seq(
270-
"com.typesafe.akka" %% "akka-actor-testkit-typed" % "2.6.16" % Test,
268+
"com.typesafe.akka" %% "akka-actor-testkit-typed" % "2.6.19" % Test,
271269
"org.scalatest" %% "scalatest" % "3.1.4" % Test,
272270
"org.scalacheck" %% "scalacheck" % "1.14.1" % Test,
273271
"com.lihaoyi" %% "requests" % "0.6.9"
@@ -286,8 +284,8 @@ lazy val scala_libraries_3 = (project in file("scala-libraries-3"))
286284
name := "scala-libraries",
287285
libraryDependencies += "org.scalatest" %% "scalatest" % "3.1.2" % Test,
288286
libraryDependencies ++= Seq(
289-
"org.apache.spark" %% "spark-core" % sparkVersion,
290-
"org.apache.spark" %% "spark-sql" % sparkVersion
287+
sparkSqlDep,
288+
sparkCoreDep
291289
),
292290
libraryDependencies ++= Seq(
293291
"org.http4s" %% "http4s-dsl" % http4sVersion,
@@ -328,11 +326,9 @@ lazy val scala_libraries_4 = (project in file("scala-libraries-4"))
328326
libraryDependencies ++= Seq(
329327
"org.scala-lang.modules" %% "scala-async" % "1.0.1",
330328
"org.scala-lang" % "scala-reflect" % scalaVersion.value % Provided,
331-
"org.tpolecat" %% "skunk-core" % "0.3.2"
332-
),
333-
libraryDependencies ++= Seq(
334-
"org.apache.spark" %% "spark-core" % sparkVersion,
335-
"org.apache.spark" %% "spark-sql" % sparkVersion
329+
"org.tpolecat" %% "skunk-core" % "0.3.2",
330+
sparkSqlDep,
331+
sparkCoreDep
336332
),
337333
scalacOptions += "-Xasync"
338334
)
@@ -414,4 +410,4 @@ lazy val scala212 = (project in file("scala212"))
414410
libraryDependencies ++= Seq(
415411
scalaTest
416412
)
417-
)
413+
)

cats-effects/src/main/scala/com/baeldung/scala/resources/ResourceHandling.scala

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,9 @@
11
package com.baeldung.scala.resources
22

3-
import cats.effect.IO
4-
import java.io.File
5-
import scala.io.Source
6-
import cats.effect.IOApp
7-
import scala.io.BufferedSource
3+
import cats.effect.{IO, IOApp, Resource}
4+
85
import java.io.FileWriter
9-
import cats.effect.Resource
6+
import scala.io.Source
107

118
object ResourceHandling extends IOApp.Simple {
129

play-scala/async-tasks/build.sbt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,6 @@ version := "1.0-SNAPSHOT"
55

66
lazy val root = (project in file(".")).enablePlugins(PlayScala)
77

8-
scalaVersion := "2.13.2"
8+
scalaVersion := "2.13.10"
99

1010
libraryDependencies += guice

play-scala/caching-in-play/build.sbt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ version := "1.0-SNAPSHOT"
55

66
lazy val root = (project in file(".")).enablePlugins(PlayScala)
77

8-
scalaVersion := "2.13.3"
8+
scalaVersion := "2.13.10"
99

1010
libraryDependencies += guice
1111
libraryDependencies += caffeine

play-scala/configuration-access/build.sbt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ version := "1.0-SNAPSHOT"
55

66
lazy val root = (project in file(".")).enablePlugins(PlayScala)
77

8-
scalaVersion := "2.13.3"
8+
scalaVersion := "2.13.10"
99

1010
libraryDependencies += guice
1111
libraryDependencies += "org.scalatestplus.play" %% "scalatestplus-play" % "5.0.0" % Test

play-scala/custom-error-handling/build.sbt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ version := "1.0-SNAPSHOT"
55

66
lazy val root = (project in file(".")).enablePlugins(PlayScala)
77

8-
scalaVersion := "2.13.2"
8+
scalaVersion := "2.13.10"
99

1010
libraryDependencies += guice
1111
libraryDependencies += "org.scalatestplus.play" %% "scalatestplus-play" % "5.0.0" % Test

play-scala/dependency-injection/build.sbt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ version := "1.0-SNAPSHOT"
44

55
lazy val root = (project in file(".")).enablePlugins(PlayScala)
66

7-
scalaVersion := "2.13.6"
7+
scalaVersion := "2.13.10"
88

99
libraryDependencies += guice
1010
libraryDependencies += "org.scalatestplus.play" %% "scalatestplus-play" % "5.0.0" % Test

play-scala/introduction-to-play/build.sbt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,6 @@ version := "1.0-SNAPSHOT"
44

55
lazy val root = (project in file(".")).enablePlugins(PlayScala)
66

7-
scalaVersion := "2.13.2"
7+
scalaVersion := "2.13.10"
88

99
libraryDependencies += guice libraryDependencies += "org.scalatestplus.play" %% "scalatestplus-play" % "5.0.0" % Test

play-scala/play-templates/build.sbt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ version := "1.0-SNAPSHOT"
55

66
lazy val root = (project in file(".")).enablePlugins(PlayScala)
77

8-
scalaVersion := "2.13.2"
8+
scalaVersion := "2.13.10"
99

1010
libraryDependencies += guice
1111
libraryDependencies += "org.scalatestplus.play" %% "scalatestplus-play" % "5.0.0" % Test

play-scala/rest-api/build.sbt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ version := "1.0-SNAPSHOT"
55

66
lazy val root = (project in file(".")).enablePlugins(PlayScala)
77

8-
scalaVersion := "2.13.2"
8+
scalaVersion := "2.13.10"
99

1010
libraryDependencies += guice
1111
libraryDependencies += "org.scalatestplus.play" %% "scalatestplus-play" % "5.0.0" % Test

scala-akka-2/src/main/scala/com/baeldung/scala/akka/http/MovieService.scala

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
package com.baeldung.scala.akka.http
2-
import scala.concurrent.Future
3-
import scala.collection.mutable.ListBuffer
42
import scala.concurrent.ExecutionContext.Implicits.global
3+
import scala.concurrent.Future
54

65
case class Movie(id: Int, name: String, length: Int)
76

scala-akka/src/main/scala/com/baeldung/scala/akka/alpakka/AlpakkaMongoIntegration.scala

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
11
package com.baeldung.scala.akka.alpakka
22

3-
import java.nio.file.FileSystems
4-
53
import akka.NotUsed
64
import akka.stream.alpakka.mongodb.scaladsl.MongoSink
75
import akka.stream.scaladsl.Source

scala-akka/src/main/scala/com/baeldung/scala/akka/scheduler/Greetings.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,6 @@ final case class Greeted(msg: String)
88
class Greetings extends Actor {
99
override def receive: Receive = {
1010
case greet: Greet =>
11-
sender ! Greeted(s"${greet.by}: Hello, ${greet.to}")
11+
sender() ! Greeted(s"${greet.by}: Hello, ${greet.to}")
1212
}
1313
}

scala-akka/src/main/scala/com/baeldung/scala/akka/stopping/MessageProcessorActor.scala

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,6 @@
11
package com.baeldung.scala.akka.stopping
22

33
import akka.actor.Actor
4-
import akka.actor.ActorSystem
5-
import akka.actor.Props
6-
import akka.actor.PoisonPill
7-
import akka.actor.DeadLetter
84

95
object MessageProcessorActor {
106
trait Message
@@ -19,7 +15,7 @@ class MessageProcessorActor extends Actor {
1915

2016
override def receive: Receive = {
2117
case msg: MessageProcessorActor.Greet =>
22-
sender ! MessageProcessorActor.Reply("Hey, " + msg.msg)
18+
sender() ! MessageProcessorActor.Reply("Hey, " + msg.msg)
2319
}
2420

2521
}

scala-akka/src/main/scala/com/baeldung/scala/akka/supervision/SupervisionApplication.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ import com.baeldung.scala.akka.supervision.SupervisionApplication.Filesystem.{Fs
1010
import com.baeldung.scala.akka.supervision.SupervisionApplication.WebServer.Request
1111

1212
import scala.concurrent.duration.DurationInt
13-
import scala.util.{Failure, Random, Success, Try}
13+
import scala.util.{Failure, Success, Try}
1414

1515
object SupervisionApplication {
1616

scala-core-2/src/main/scala/com/baeldung/scala/concurrency/FutureAndPromise.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ object ScalaAndPromise {
5353
} yield User(name, email, hashedPassword, avatar)
5454

5555
def runByPromise[T](block: => T)(implicit ec: ExecutionContext): Future[T] = {
56-
val p = Promise[T]
56+
val p = Promise[T]()
5757
ec.execute { () =>
5858
try {
5959
p.success(block)

scala-core-2/src/main/scala/com/baeldung/scala/exceptionhandling/ExceptionHandling.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ object ExceptionHandling {
2121
try {
2222
divide(a, 0)
2323
} catch {
24-
case e: DivideByZero => null
24+
case _: DivideByZero => null
2525
} finally {
2626
println("Finished")
2727
}

scala-core-3/src/main/scala/com/baeldung/scala/await/AwaitFuture.scala

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,16 @@
11
package com.baeldung.scala.await
22

3-
import scala.concurrent.{ Await, Future }
4-
import scala.io.Source
53
import scala.concurrent.ExecutionContext.Implicits.global
4+
import scala.concurrent.Future
5+
import scala.io.Source
66

77
object AwaitFuture {
88

99
def fetchDataFromUrl(url : String) : Future[String] = Future {
1010
Source.fromURL(url).getLines().mkString
1111
}
1212

13-
def fetchDataFrom(url : String, waitTime : Long = 0l) : Future[String] = Future {
13+
def fetchDataFrom(url : String, waitTime : Long = 0L) : Future[String] = Future {
1414
Thread.sleep(waitTime)
1515
Source.fromURL(url).getLines().mkString
1616
}

scala-core-3/src/main/scala/com/baeldung/scala/typecasts/ErrorHandling.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ object ErrorHandling extends App {
3333
case Failure(e: UnknownHostException) =>
3434
println(s"Unknown host specified: ${e.getMessage}")
3535
case Failure(e: IOException) =>
36-
println("Network failure: ${e.getMessage}")
36+
println(s"Network failure: ${e.getMessage}")
3737
case Failure(t) =>
3838
t.printStackTrace()
3939
}

scala-core-4/src/main/scala/com/baeldung/scala/assertvsrequire/RequireUsage.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ object RequireUsage extends App {
1212
issueDrivingLicense("Jr. Darwin", 5) // prints "Failed in require precondition"
1313
} catch {
1414
case e: IllegalArgumentException =>
15-
println("Failed in require precondition")
15+
println("Failed in require precondition-"+e.getMessage)
1616
}
1717

1818
}

scala-core-5/src/main/scala/com/baeldung/scala/datesandtimes/JavaUtilDate.scala

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@ import java.text.SimpleDateFormat
33

44
import scala.concurrent.duration.Duration
55
import scala.concurrent.{Await, Future}
6-
import scala.languageFeature.experimental.macros
76

87
object JavaUtilDate extends App{
98

@@ -29,5 +28,5 @@ object JavaUtilDate extends App{
2928
val date1 = Await.result(r1, Duration.Inf)
3029
val date2 = Await.result(r2, Duration.Inf)
3130

32-
println(date1, date2) // Prints "Wed Jul 01 2020, Fri Aug 21 2020"
31+
println(date1 +", "+ date2) // Prints "Wed Jul 01 2020, Fri Aug 21 2020"
3332
}

scala-core/src/main/scala/com/baeldung/scala/exceptionhandling/Examples.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
package com.baeldung.scala.exceptionhandling
22

3-
import scala.util.{Failure, Success, Try, control}
3+
import scala.util.Try
44
import scala.util.control.Exception._
55

66
object Examples {

scala-design-patterns/src/main/scala/com/baeldung/scala/cakepattern/CakePattern.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
package com.baeldung.scala.cakepattern
22

3-
import scala.collection.JavaConverters._
3+
import scala.jdk.CollectionConverters._
44

55
object CakePattern {
66

scala-js/build.sbt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ lazy val root = (project in file("."))
99
jsEnv := new org.scalajs.jsenv.jsdomnodejs.JSDOMNodeJSEnv()
1010
)
1111

12-
scalaVersion := "2.13.1"
12+
scalaVersion := "2.13.10"
1313

1414
scalaJSUseMainModuleInitializer := true
1515
libraryDependencies += "org.scala-js" %%% "scalajs-dom" % "2.2.0"

scala-lagom/build.sbt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ organization in ThisBuild := "com.baeldung"
22
version in ThisBuild := "1.0-SNAPSHOT"
33

44
// the Scala version that will be used for cross-compiled libraries
5-
scalaVersion in ThisBuild := "2.13.0"
5+
scalaVersion in ThisBuild := "2.13.10"
66

77
val macwire = "com.softwaremill.macwire" %% "macros" % "2.3.3" % "provided"
88
val scalaTest = "org.scalatest" %% "scalatest" % "3.1.1" % Test

scala-lang-2/src/main/scala/com/baeldung/scala/voidtypes/UnitReturnType.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ object UnitReturnType extends App{
1010
println("result of function returning Unit: %s".format(functionReturnUnit))
1111

1212
def functionReturnImplicitUnit{
13-
"""
13+
s"""
1414
do something, don't return anything
1515
"""
1616
}

scala-libraries-2/src/main/scala/com/baeldung/cache/service/AsyncQueryMemoizeService.scala

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@ import scalacache._
44
import scalacache.guava._
55
import com.google.common.cache.CacheBuilder
66
import scalacache.modes.scalaFuture._
7-
import scalacache.serialization.binary._
87
import scalacache.memoization._
98
import scala.concurrent.ExecutionContext.Implicits.global
109

scala-libraries-2/src/main/scala/com/baeldung/cache/service/CatsService.scala

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@ import com.google.common.cache.CacheBuilder
55
import scalacache._
66
import scalacache.memoization._
77
import scalacache.guava.GuavaCache
8-
import scala.concurrent.duration._
98

109
object GuavaCacheCatsConfig {
1110
val underlyingGuavaCacheCats =

scala-libraries-2/src/main/scala/com/baeldung/cache/service/SyncQueryCustomMemoizeKeyService.scala

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,10 @@
11
package com.baeldung.cache.service
22

3+
import com.google.common.cache.CacheBuilder
34
import scalacache._
45
import scalacache.guava._
5-
import com.google.common.cache.CacheBuilder
6-
import scalacache.memoization.MethodCallToStringConverter.onlyMethodParams
7-
import scalacache.modes.sync._
8-
import scalacache.serialization.binary._
96
import scalacache.memoization._
7+
import scalacache.modes.sync._
108

119
import scala.concurrent.duration._
1210

0 commit comments

Comments
 (0)