Skip to content

Commit

Permalink
WX-772 Update Scala to 2.13.9 (#6928)
Browse files Browse the repository at this point in the history
* Update Scala to 2.13.9

* Try updating sbt-scoverage

* Does this version exist anywhere we can see?

* This version actually exists

* Update library version to remove conflict

* Codegen version

* Fix fun new 2.13.9 compiler errors

* Resolve warnings

* Newest Scala?

* I guess not

* Does this please Travis?

* force ci

* Back out changes to generated code

Co-authored-by: Adam Nichols <[email protected]>
  • Loading branch information
jgainerdewar and aednichols authored Oct 17, 2022
1 parent 622c8e6 commit 1a38896
Show file tree
Hide file tree
Showing 25 changed files with 54 additions and 46 deletions.
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,11 @@ supported.
All DRS inputs to a task are now localized in a single PAPI action, which should improve speed and resolve
failures observed when attempting to localize a large number of DRS files.

### Security Patching

Updates to dependencies to fix security vulnerabilities.


## 84 Release Notes

### CromIAM enabled user checks
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ trait StandardCachingActorHelper extends JobCachingActorHelper {

val fileMetadata = jobPaths.metadataPaths

runtimeAttributesMetadata ++ fileMetadata ++ nonStandardMetadata
nonStandardMetadata ++ runtimeAttributesMetadata ++ fileMetadata
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ class RootWorkflowFileHashCacheActor private[callcaching](override val ioActor:
// hash to become available.
cache.put(key, FileHashValueRequested(requesters = requester :: requesters))
case FileHashSuccess(value) =>
sender() ! Tuple2(hashCommand.fileHashContext, IoSuccess(requester.ioCommand, value))
sender() ! Tuple2[Any, Any](hashCommand.fileHashContext, IoSuccess(requester.ioCommand, value))
case FileHashFailure(error) =>
sender() ! Tuple2(hashCommand.fileHashContext, IoFailure(requester.ioCommand, new IOException(error)))
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -189,7 +189,7 @@ class BigQueryReporter(override val params: ErrorReporterParams) extends ErrorRe
}

private def toJobKeyValueRow(jobKeyValueEntry: JobKeyValueEntry): RowToInsert = {
RowToInsert of Map(
RowToInsert of Map[String, Any](
"call_fully_qualified_name" -> jobKeyValueEntry.callFullyQualifiedName,
"job_attempt" -> jobKeyValueEntry.jobAttempt,
"job_index" -> jobKeyValueEntry.jobIndex,
Expand Down
2 changes: 1 addition & 1 deletion codegen_java/build.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ lazy val root = (project in file(".")).
Seq(organization := "org.broadinstitute.cromwell",
name := "cromwell-client",
version := createVersion("0.1"),
scalaVersion := "2.13.8",
scalaVersion := "2.13.9",
scalacOptions ++= Seq("-feature"),
compile / javacOptions ++= Seq("-Xlint:deprecation"),
Compile / packageDoc / publishArtifact := false,
Expand Down
4 changes: 2 additions & 2 deletions common/src/main/scala/common/util/TerminalUtil.scala
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,10 @@ object TerminalUtil {
def maxWidth(lengths: Seq[Seq[Int]], column: Int) = lengths.map { length => length(column) }.max
val widths = (rows :+ header).map { row => row.map { s => s.length } }
val maxWidths = widths.head.indices.map { column => maxWidth(widths, column) }
val tableHeader = header.indices.map { i => header(i).padTo(maxWidths(i), " ").mkString("") }.mkString("|")
val tableHeader = header.indices.map { i => header(i).padTo(maxWidths(i), ' ').mkString("") }.mkString("|")
val tableDivider = header.indices.map { i => "-" * maxWidths(i) }.mkString("|")
val tableRows = rows.map { row =>
val mdRow = row.indices.map { i => row(i).padTo(maxWidths(i), " ").mkString("") }.mkString("|")
val mdRow = row.indices.map { i => row(i).padTo(maxWidths(i), ' ').mkString("") }.mkString("|")
s"|$mdRow|"
}
s"|$tableHeader|\n|$tableDivider|\n${tableRows.mkString("\n")}\n"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ class EnhancedCollectionsSpec extends AsyncFlatSpec with Matchers {
behavior of "EnhancedCollections"

it should "filter a List by type and return a List" in {
val objectList = List("hello", 3, None, "world")
val objectList = List[Any]("hello", 3, None, "world")
val stringList = objectList.filterByType[String]

stringList should be(List("hello", "world"))
Expand All @@ -28,14 +28,14 @@ class EnhancedCollectionsSpec extends AsyncFlatSpec with Matchers {
}

it should "filter a Set by type and return a Set" in {
val objectSet = Set("hello", 3, None, "world")
val objectSet = Set[Any]("hello", 3, None, "world")
val intSet: Set[Int] = objectSet.filterByType[Int]

intSet should be(Set(3))
}

it should "find the first Int in a List" in {
val objectSet = List("hello", 3, None, 4, "world")
val objectSet = List[Any]("hello", 3, None, 4, "world")
objectSet.firstByType[Int] should be(Some(3))
}

Expand Down
4 changes: 2 additions & 2 deletions core/src/test/scala/cromwell/core/io/IoClientHelperSpec.scala
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ class IoClientHelperSpec extends TestKitSuite with AnyFlatSpecLike with Matchers
val testActor = TestActorRef(new IoClientHelperTestActor(ioActorProbe.ref, delegateProbe.ref, backoff, noResponseTimeout))

val command = DefaultIoSizeCommand(mock[Path])
val response = IoSuccess(command, 5)
val response = IoSuccess(command, 5L)

// Send the command
testActor.underlyingActor.sendMessage(command)
Expand Down Expand Up @@ -58,7 +58,7 @@ class IoClientHelperSpec extends TestKitSuite with AnyFlatSpecLike with Matchers

val commandContext = "context"
val command = DefaultIoSizeCommand(mock[Path])
val response = IoSuccess(command, 5)
val response = IoSuccess(command, 5L)

// Send the command
testActor.underlyingActor.sendMessageWithContext(commandContext, command)
Expand Down
2 changes: 1 addition & 1 deletion core/src/test/scala/cromwell/core/retry/BackoffSpec.scala
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ class BackoffSpec extends AnyFlatSpec with CromwellTimeoutSpec with Matchers {

it should "parse config" in {
val config = ConfigFactory.parseMap(
Map(
Map[String, Any](
"min" -> "5 seconds",
"max" -> "30 seconds",
"multiplier" -> 6D,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ class FetchCachedResultsActor(cacheResultId: CallCachingEntryId, replyTo: ActorR

val sourceCacheDetails = Seq(result.callCachingEntry.workflowExecutionUuid,
result.callCachingEntry.callFullyQualifiedName,
result.callCachingEntry.jobIndex).mkString(":")
result.callCachingEntry.jobIndex.toString).mkString(":")

CachedOutputLookupSucceeded(simpletons, jobDetritusFiles.toMap,
result.callCachingEntry.returnCode,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -753,7 +753,7 @@ class EngineJobExecutionActor(replyTo: ActorRef,

private def logCacheHitSuccessAndNotifyMetadata(data: ResponsePendingData): Unit = {

val metadataMap = Map(callCachingHitResultMetadataKey -> true) ++ data.ejeaCacheHit.flatMap(_.details).map(details => callCachingReadResultMetadataKey -> s"Cache Hit: $details").toMap
val metadataMap = Map[String, Any](callCachingHitResultMetadataKey -> true) ++ data.ejeaCacheHit.flatMap(_.details).map(details => callCachingReadResultMetadataKey -> s"Cache Hit: $details").toMap

writeToMetadata(metadataMap)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import scala.util.{Failure, Success, Try}
class ValidatingCachingConfigSpec extends AnyFlatSpec with CromwellTimeoutSpec with Matchers with TableDrivenPropertyChecks {

it should "run config tests" in {
val cases = Table(
val cases = Table[String, Any](
("config" , "exceptionMessage" ),
("enabled = not-a-boolean", "String: 1: enabled has type STRING rather than BOOLEAN" ),
("enabled = true" , true ),
Expand Down
8 changes: 5 additions & 3 deletions project/Dependencies.scala
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ object Dependencies {
private val postgresV = "42.4.1"
private val pprintV = "0.7.3"
private val rdf4jV = "3.7.1"
private val refinedV = "0.9.29"
private val refinedV = "0.10.1"
private val rhinoV = "1.7.14"

private val scalaCollectionCompatV = "2.5.0"
Expand Down Expand Up @@ -480,7 +480,8 @@ object Dependencies {
val coreDependencies: List[ModuleID] = List(
"com.google.auth" % "google-auth-library-oauth2-http" % googleOauth2V,
"com.chuusai" %% "shapeless" % shapelessV,
"com.storm-enroute" %% "scalameter" % scalameterV % Test,
"com.storm-enroute" %% "scalameter" % scalameterV % Test
exclude("org.scala-lang.modules", "scala-xml_2.13"),
"com.github.scopt" %% "scopt" % scoptV,
) ++ akkaStreamDependencies ++ configDependencies ++ catsDependencies ++ circeDependencies ++
googleApiClientDependencies ++ statsDDependencies ++ betterFilesDependencies ++
Expand Down Expand Up @@ -509,7 +510,8 @@ object Dependencies {
"com.storm-enroute" %% "scalameter" % scalameterV
exclude("com.fasterxml.jackson.core", "jackson-databind")
exclude("com.fasterxml.jackson.module", "jackson-module-scala")
exclude("org.scala-tools.testing", "test-interface"),
exclude("org.scala-tools.testing", "test-interface")
exclude("org.scala-lang.modules", "scala-xml_2.13"),
"com.fasterxml.jackson.core" % "jackson-databind" % jacksonV,
"io.github.andrebeat" %% "scala-pool" % scalaPoolV
) ++ swaggerUiDependencies ++ akkaHttpDependencies ++ akkaHttpCirceIntegrationDependency ++ circeDependencies ++
Expand Down
2 changes: 1 addition & 1 deletion project/Settings.scala
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ object Settings {
assembly / assemblyMergeStrategy := customMergeStrategy.value,
)

val Scala2_13Version = "2.13.8"
val Scala2_13Version = "2.13.9"
private val ScalaVersion: String = Scala2_13Version
private val sharedSettings: Seq[Setting[_]] =
cromwellVersionWithGit ++ publishingSettings ++ List(
Expand Down
2 changes: 1 addition & 1 deletion project/plugins.sbt
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
addSbtPlugin("se.marcuslonnberg" % "sbt-docker" % "1.9.0")
addSbtPlugin("com.eed3si9n" % "sbt-assembly" % "1.1.1")
addSbtPlugin("com.github.sbt" % "sbt-git" % "2.0.0")
addSbtPlugin("org.scoverage" % "sbt-scoverage" % "1.9.3")
addSbtPlugin("org.scoverage" % "sbt-scoverage" % "2.0.4")
addDependencyTreePlugin
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,7 @@ object SelectiveTsvInstrumentationServiceActor {

val header = (List("timestamp") ++ interestingFields).mkString("\t")
val rows = stateHistory.map { case (timestamp, fieldMap) =>
(Vector(timestamp.toString) ++ interestingFields.map(f => fieldMap.getOrElse(f, 0))).mkString("\t")
(Vector(timestamp.toString) ++ interestingFields.map(f => fieldMap.getOrElse(f, 0).toString)).mkString("\t")
}
Vector(header) ++ rows
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -287,7 +287,7 @@ class MetadataDatabaseAccessSpec extends AnyFlatSpec with CromwellTimeoutSpec wi
}
// Filter by workflow id within random Ids
_ <- dataAccess.queryWorkflowSummaries(WorkflowQueryParameters(
(randomIds :+ workflow1Id).map(id => WorkflowQueryKey.Id.name -> id.toString))) map { case (response, _) =>
(randomIds :+ workflow1Id.toString).map(id => WorkflowQueryKey.Id.name -> id))) map { case (response, _) =>
val resultsById = response.results groupBy {
_.name
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ trait PipelinesApiJobCachingActorHelper extends StandardCachingActorHelper {
.get(WorkflowOptionKeys.GoogleProject)
.getOrElse(jesAttributes.project)

Map(
Map[String, Any](
PipelinesApiMetadataKeys.GoogleProject -> googleProject,
PipelinesApiMetadataKeys.ExecutionBucket -> initializationData.workflowPaths.executionRootString,
PipelinesApiMetadataKeys.EndpointUrl -> jesAttributes.endpointUrl,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -141,9 +141,9 @@ class PipelinesApiAsyncBackendJobExecutionActor(standardParams: StandardAsyncExe
}

val optional = Option(output) collectFirst { case o: PipelinesApiFileOutput if o.secondary || o.optional => "optional" } getOrElse "required"
val contentType = output.contentType.getOrElse("")
val contentType = output.contentType.map(_.toString).getOrElse("")

List(kind, output.cloudPath, output.containerPath, optional, contentType)
List(kind, output.cloudPath.toString, output.containerPath.toString, optional, contentType)
} mkString("\"", "\"\n| \"", "\"")

val parallelCompositeUploadThreshold = jobDescriptor.workflowDescriptor.workflowOptions.getOrElse(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -82,9 +82,9 @@ class DeserializationSpec extends AnyFlatSpec with CromwellTimeoutSpec with Matc
"commands" -> List[String]("echo", "hello").asJava
).asJava
).asJava,
"resources" -> Map(
"resources" -> Map[String, Object](
"projectId" -> "project",
"virtualMachine" -> Map(
"virtualMachine" -> Map[String, Any](
"machineType" -> "custom-1-1024",
"preemptible" -> false
).asJava
Expand Down Expand Up @@ -117,7 +117,7 @@ class DeserializationSpec extends AnyFlatSpec with CromwellTimeoutSpec with Matc
"commands" -> List[String]("echo", "hello").asJava
).asJava
).asJava,
"resources" -> Map(
"resources" -> Map[String, Object](
"projectId" -> "project",
"virtualMachine" -> Map(
"machineType" -> "custom-1-1024",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -146,9 +146,9 @@ class PipelinesApiAsyncBackendJobExecutionActor(standardParams: StandardAsyncExe
}

val optional = Option(output) collectFirst { case o: PipelinesApiFileOutput if o.secondary || o.optional => "optional" } getOrElse "required"
val contentType = output.contentType.getOrElse("")
val contentType = output.contentType.map(_.toString).getOrElse("")

List(kind, output.cloudPath, output.containerPath, optional, contentType)
List(kind, output.cloudPath.toString, output.containerPath.toString, optional, contentType)
} mkString("\"", "\"\n| \"", "\"")

val parallelCompositeUploadThreshold = jobDescriptor.workflowDescriptor.workflowOptions.getOrElse(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -81,9 +81,9 @@ class DeserializationSpec extends AnyFlatSpec with CromwellTimeoutSpec with Matc
"commands" -> List[String]("echo", "hello").asJava
).asJava
).asJava,
"resources" -> Map(
"resources" -> Map[String, Object](
"projectId" -> "project",
"virtualMachine" -> Map(
"virtualMachine" -> Map[String, Any](
"machineType" -> "custom-1-1024",
"preemptible" -> false
).asJava
Expand Down Expand Up @@ -115,7 +115,7 @@ class DeserializationSpec extends AnyFlatSpec with CromwellTimeoutSpec with Matc
"commands" -> List[String]("echo", "hello").asJava
).asJava
).asJava,
"resources" -> Map(
"resources" -> Map[String, Object](
"projectId" -> "project",
"virtualMachine" -> Map(
"machineType" -> "custom-1-1024",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -196,7 +196,7 @@ object AstTools {
val pairType = womType.asInstanceOf[WomPairType]
WomPair(subElements.head.womValue(pairType.leftType, wdlSyntaxErrorFormatter), subElements(1).womValue(pairType.rightType, wdlSyntaxErrorFormatter))
} else {
throw new SyntaxError(s"Could not convert AST to a $womType (${Option(astNode).getOrElse("No AST").toString})")
throw new SyntaxError(s"Could not convert AST to a $womType (${Option(astNode).map(_.toString).getOrElse("No AST")})")
}
}

Expand Down Expand Up @@ -224,7 +224,7 @@ object AstTools {
case a: Ast if a.getName == "TupleLiteral" => astTupleToValue(a)
case a: Ast if a.getName == "MapLiteral" && womType.isInstanceOf[WomMapType] => astToMap(a)
case a: Ast if a.getName == "ObjectLiteral" && womType == WomObjectType => astToObject(a)
case _ => throw new SyntaxError(s"Could not convert AST to a $womType (${Option(astNode).getOrElse("No AST").toString})")
case _ => throw new SyntaxError(s"Could not convert AST to a $womType (${Option(astNode).map(_.toString).getOrElse("No AST")})")
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion wom/src/test/scala/wom/types/WomFileTypeSpec.scala
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ class WomFileTypeSpec extends AnyFlatSpec with CromwellTimeoutSpec with Matchers
}
}

lazy val failedCoercionTests = Table(
lazy val failedCoercionTests = Table[String, WomType, Any, String](
("description", "womFileType", "value", "expected"),

("a double to a dir", WomUnlistedDirectoryType, 6.28318,
Expand Down
21 changes: 11 additions & 10 deletions wom/src/test/scala/wom/types/WomTypeSpec.scala
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import wom.values._

import scala.runtime.ScalaRunTime
import scala.util.Random
import scala.util.matching.Regex


class WomTypeSpec extends AnyFlatSpec with CromwellTimeoutSpec with Matchers {
Expand All @@ -32,7 +33,7 @@ class WomTypeSpec extends AnyFlatSpec with CromwellTimeoutSpec with Matchers {
WomSingleFileType.stableName shouldEqual "File"
}

val rawValuesCoercedToType = Table(
val rawValuesCoercedToType = Table[Any, WomType, Any, Regex](
(
"Raw Value",
"WomType",
Expand All @@ -43,33 +44,33 @@ class WomTypeSpec extends AnyFlatSpec with CromwellTimeoutSpec with Matchers {
WomString("hello"),
WomIntegerType,
classOf[NumberFormatException],
"For input string: \"hello\""
"For input string: \"hello\"".r
),
(
WomInteger(0),
WomBooleanType,
classOf[IllegalArgumentException],
"""No coercion defined from wom value\(s\) '0' of type 'Int' to 'Boolean'."""
"""No coercion defined from wom value\(s\) '0' of type 'Int' to 'Boolean'.""".r
),
(
0,
WomBooleanType,
classOf[IllegalArgumentException],
"No coercion defined from '0' of type 'java.lang.Integer' to 'Boolean'."
"No coercion defined from '0' of type 'java.lang.Integer' to 'Boolean'.".r
),
(
Array(0, 1, 2, 3, 4),
WomBooleanType,
classOf[IllegalArgumentException],
"""No coercion defined from 'Array\(0, 1, 2\)' of type 'int\[\]' to 'Boolean'."""
"""No coercion defined from 'Array\(0, 1, 2\)' of type 'int\[\]' to 'Boolean'.""".r
),
(
new AnyRef {},
WomBooleanType,
classOf[IllegalArgumentException],
"No coercion defined from" +
("No coercion defined from" +
""" 'wom.types.WomTypeSpec\$\$anon\$(.*)@.*' of type""" +
""" 'wom.types.WomTypeSpec\$\$anon\$\1' to 'Boolean'."""
""" 'wom.types.WomTypeSpec\$\$anon\$\1' to 'Boolean'.""").r
),
(
WomArray(WomArrayType(WomOptionalType(WomIntegerType)), Seq(
Expand All @@ -81,19 +82,19 @@ class WomTypeSpec extends AnyFlatSpec with CromwellTimeoutSpec with Matchers {
),
WomOptionalType(WomMaybeEmptyArrayType(WomIntegerType)),
classOf[IllegalArgumentException],
"""No coercion defined from wom value\(s\) '\[0, 1, 2\]' of type 'Array\[Int\?\]' to 'Array\[Int\]\?'."""
"""No coercion defined from wom value\(s\) '\[0, 1, 2\]' of type 'Array\[Int\?\]' to 'Array\[Int\]\?'.""".r
),
(
WomArray(WomArrayType(WomOptionalType(WomIntegerType)), Seq(WomOptionalValue.none(WomIntegerType))),
WomOptionalType(WomMaybeEmptyArrayType(WomIntegerType)),
classOf[IllegalArgumentException],
"""No coercion defined from wom value\(s\) '\[null\]' of type 'Array\[Int\?\]' to 'Array\[Int\]\?'."""
"""No coercion defined from wom value\(s\) '\[null\]' of type 'Array\[Int\?\]' to 'Array\[Int\]\?'.""".r
),
(
WomOptionalValue.none(WomArrayType(WomIntegerType)),
WomMaybeEmptyArrayType(WomOptionalType(WomIntegerType)),
classOf[IllegalArgumentException],
"""No coercion defined from wom value\(s\) 'null' of type 'Array\[Int\]\?' to 'Array\[Int\?\]'."""
"""No coercion defined from wom value\(s\) 'null' of type 'Array\[Int\]\?' to 'Array\[Int\?\]'.""".r
)
)

Expand Down

0 comments on commit 1a38896

Please sign in to comment.