Skip to content

Commit ebb6232

Browse files
authored
fix most scala deprecation warnings rooted in this build (#1095)
* more * more * more * more * upgrade odb * back to latest released codegen for now * fmt
1 parent 720c5dd commit ebb6232

37 files changed

Lines changed: 105 additions & 95 deletions

File tree

build.sbt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
name := "codepropertygraph"
22

33
// parsed by project/Versions.scala, updated by updateDependencies.sh
4-
val overflowdbVersion = "1.28"
4+
val overflowdbVersion = "1.29"
55

66
inThisBuild(
77
List(

codepropertygraph/src/main/scala/io/shiftleft/Implicits.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ object Implicits {
1010
implicit class IteratorDeco[T](val iterator: Iterator[T]) extends AnyVal {
1111
def onlyChecked: T = {
1212
if (iterator.hasNext) {
13-
val res = iterator.next
13+
val res = iterator.next()
1414
if (iterator.hasNext) {
1515
logger.warn("iterator was expected to have exactly one element, but it actually has more")
1616
}

codepropertygraph/src/main/scala/io/shiftleft/SerializedCpg.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ class SerializedCpg extends AutoCloseable {
1919
* Create Serialized CPG from existing file. If the file does not exist,
2020
* an empty Serialized CPG is created.
2121
**/
22-
def this(filename: String) {
22+
def this(filename: String) = {
2323
this()
2424
initZipFilesystem(filename)
2525
}

codepropertygraph/src/main/scala/io/shiftleft/codepropertygraph/cpgloading/CpgOverlayLoader.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -154,7 +154,7 @@ private class CpgOverlayApplier(graph: Graph) {
154154
case STRING_LIST =>
155155
val listBuilder = List.newBuilder[String]
156156
propertyValue.getStringList.getValuesList.forEach(listBuilder.addOne)
157-
element.setProperty(propertyName, listBuilder.result)
157+
element.setProperty(propertyName, listBuilder.result())
158158
case VALUE_NOT_SET =>
159159
case valueCase =>
160160
throw new RuntimeException("Error: unsupported property case: " + valueCase)

codepropertygraph/src/test/scala/io/shiftleft/codepropertygraph/cpgloading/DiffGraphTest.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ class DiffGraphTest extends AnyWordSpec with Matchers {
9090
builder.addNode(secondNode)
9191
builder.addNode(thirdNode)
9292
val keyPool = Some(new IntervalKeyPool(20, 30))
93-
val appliedGraph = DiffGraph.Applier.applyDiff(builder.build, graph, true, keyPool)
93+
val appliedGraph = DiffGraph.Applier.applyDiff(builder.build(), graph, true, keyPool)
9494
appliedGraph.nodeToGraphId(firstNode) shouldBe 20
9595
appliedGraph.nodeToGraphId(secondNode) shouldBe 21
9696
appliedGraph.nodeToGraphId(thirdNode) shouldBe 22

codepropertygraph/src/test/scala/io/shiftleft/passes/CpgOverlayIntegrationTest.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,7 @@ class CpgOverlayIntegrationTest extends AnyWordSpec with Matchers {
111111
def applyDiffAndGetInverse(cpg: Cpg)(fun: DiffGraph.Builder => Unit): DiffGraph = {
112112
val builder = DiffGraph.newBuilder
113113
fun(builder)
114-
val diff = builder.build
114+
val diff = builder.build()
115115
val applied = DiffGraph.Applier.applyDiff(diff, cpg, undoable = true)
116116
val inverse = applied.inverseDiffGraph.get
117117
val inverseProto = new DiffGraphProtoSerializer().serialize(inverse)

codepropertygraph/src/test/scala/io/shiftleft/passes/KeyPoolTests.scala

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,8 @@ class KeyPoolTests extends AnyWordSpec with Matchers {
3232
keySets.combinations(2).foreach {
3333
case List(x: Set[Long], y: Set[Long]) =>
3434
x.intersect(y).isEmpty shouldBe true
35+
case _ =>
36+
fail()
3537
}
3638
}
3739

@@ -63,7 +65,7 @@ class KeyPoolTests extends AnyWordSpec with Matchers {
6365
pool1.last should be < pool2.first
6466
pool2.last should be < pool3.first
6567
pool3.last shouldBe Long.MaxValue - 1
66-
case _ => fail
68+
case _ => fail()
6769
}
6870
}
6971

console/src/test/scala/io/shiftleft/console/ConsoleTests.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -169,7 +169,7 @@ class ConsoleTests extends AnyWordSpec with Matchers {
169169
case Some(p) =>
170170
p.name shouldBe projectName
171171
console.workspace.projectByCpg(p.cpg.get).map(_.name) shouldBe Some(projectName)
172-
case None => fail
172+
case None => fail()
173173
}
174174
}
175175

console/src/test/scala/io/shiftleft/console/PluginManagerTests.scala

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ class PluginManagerTests extends AnyWordSpec with Matchers {
2626
manager.pluginDir match {
2727
case Some(dir) =>
2828
dir.toFile.list().toList shouldBe List("joernext-test-foo.jar")
29-
case None => fail
29+
case None => fail()
3030
}
3131
}
3232

@@ -37,7 +37,7 @@ class PluginManagerTests extends AnyWordSpec with Matchers {
3737
case Some(dir) =>
3838
dir.toFile.list().toList shouldBe List("joernext-test-foo.json")
3939
(manager.installDir / "out.txt").exists shouldBe true
40-
case None => fail
40+
case None => fail()
4141
}
4242
}
4343

console/src/test/scala/io/shiftleft/console/cpgqlserver/CPGQLServerTests.scala

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ class CPGQLServerTests extends AnyWordSpec with Matchers {
3838
"CPGQLServer" should {
3939

4040
"allow websocket connections to the `/connect` endpoint" in Fixture() { host =>
41-
val webSocketTextMsg = scala.concurrent.Promise[String]
41+
val webSocketTextMsg = scala.concurrent.Promise[String]()
4242
cask.util.WsClient.connect(s"$host/connect") {
4343
case cask.Ws.Text(msg) => webSocketTextMsg.success(msg)
4444
}
@@ -73,7 +73,7 @@ class CPGQLServerTests extends AnyWordSpec with Matchers {
7373
}
7474

7575
"allow fetching the result of a completed query using its UUID" in Fixture() { host =>
76-
var webSocketTextMsg = scala.concurrent.Promise[String]
76+
var webSocketTextMsg = scala.concurrent.Promise[String]()
7777
cask.util.WsClient.connect(s"$host/connect") {
7878
case cask.Ws.Text(msg) => webSocketTextMsg.success(msg)
7979
}
@@ -82,7 +82,7 @@ class CPGQLServerTests extends AnyWordSpec with Matchers {
8282
val queryUUID = postQueryResponse("uuid").str
8383
queryUUID.length should not be (0)
8484

85-
webSocketTextMsg = scala.concurrent.Promise[String]
85+
webSocketTextMsg = scala.concurrent.Promise[String]()
8686
val queryResultWSMessage = Await.result(webSocketTextMsg.future, DefaultPromiseAwaitTimeout)
8787
queryResultWSMessage.length should not be (0)
8888

@@ -94,7 +94,7 @@ class CPGQLServerTests extends AnyWordSpec with Matchers {
9494
}
9595

9696
"disallow fetching the result of a completed query with an invalid auth header" in Fixture() { host =>
97-
var webSocketTextMsg = scala.concurrent.Promise[String]
97+
var webSocketTextMsg = scala.concurrent.Promise[String]()
9898
cask.util.WsClient.connect(s"$host/connect") {
9999
case cask.Ws.Text(msg) => webSocketTextMsg.success(msg)
100100
}
@@ -103,7 +103,7 @@ class CPGQLServerTests extends AnyWordSpec with Matchers {
103103
val queryUUID = postQueryResponse("uuid").str
104104
queryUUID.length should not be (0)
105105

106-
webSocketTextMsg = scala.concurrent.Promise[String]
106+
webSocketTextMsg = scala.concurrent.Promise[String]()
107107
val queryResultWSMessage = Await.result(webSocketTextMsg.future, DefaultPromiseAwaitTimeout)
108108
queryResultWSMessage.length should not be (0)
109109

@@ -114,7 +114,7 @@ class CPGQLServerTests extends AnyWordSpec with Matchers {
114114

115115
"write a well-formatted message to a websocket connection when a query has finished evaluation" in Fixture() {
116116
host =>
117-
var webSocketTextMsg = scala.concurrent.Promise[String]
117+
var webSocketTextMsg = scala.concurrent.Promise[String]()
118118
cask.util.WsClient.connect(s"$host/connect") {
119119
case cask.Ws.Text(msg) => webSocketTextMsg.success(msg)
120120
}
@@ -124,7 +124,7 @@ class CPGQLServerTests extends AnyWordSpec with Matchers {
124124
val queryUUID = postQueryResponse("uuid").str
125125
queryUUID.length should not be (0)
126126

127-
webSocketTextMsg = scala.concurrent.Promise[String]
127+
webSocketTextMsg = scala.concurrent.Promise[String]()
128128
val queryResultWSMessage = Await.result(webSocketTextMsg.future, DefaultPromiseAwaitTimeout)
129129
queryResultWSMessage.length should not be (0)
130130

@@ -139,7 +139,7 @@ class CPGQLServerTests extends AnyWordSpec with Matchers {
139139
}
140140

141141
"write a well-formatted message to a websocket connection when a query failed evaluation" in Fixture() { host =>
142-
var webSocketTextMsg = scala.concurrent.Promise[String]
142+
var webSocketTextMsg = scala.concurrent.Promise[String]()
143143
cask.util.WsClient.connect(s"$host/connect") {
144144
case cask.Ws.Text(msg) => webSocketTextMsg.success(msg)
145145
}
@@ -149,7 +149,7 @@ class CPGQLServerTests extends AnyWordSpec with Matchers {
149149
val queryUUID = postQueryResponse("uuid").str
150150
queryUUID.length should not be (0)
151151

152-
webSocketTextMsg = scala.concurrent.Promise[String]
152+
webSocketTextMsg = scala.concurrent.Promise[String]()
153153
val queryResultWSMessage = Await.result(webSocketTextMsg.future, DefaultPromiseAwaitTimeout)
154154
queryResultWSMessage.length should not be (0)
155155

@@ -166,7 +166,7 @@ class CPGQLServerTests extends AnyWordSpec with Matchers {
166166
}
167167

168168
"receive error when attempting to retrieve result with invalid uuid" in Fixture() { host =>
169-
val webSocketTextMsg = scala.concurrent.Promise[String]
169+
val webSocketTextMsg = scala.concurrent.Promise[String]()
170170
cask.util.WsClient.connect(s"$host/connect") {
171171
case cask.Ws.Text(msg) => webSocketTextMsg.success(msg)
172172
}
@@ -178,7 +178,7 @@ class CPGQLServerTests extends AnyWordSpec with Matchers {
178178
}
179179

180180
"return a valid JSON response when calling /result with incorrectly-formatted UUID parameter" in Fixture() { host =>
181-
val webSocketTextMsg = scala.concurrent.Promise[String]
181+
val webSocketTextMsg = scala.concurrent.Promise[String]()
182182
cask.util.WsClient.connect(s"$host/connect") {
183183
case cask.Ws.Text(msg) => webSocketTextMsg.success(msg)
184184
}

0 commit comments

Comments
 (0)