Skip to content

Commit 711e6f7

Browse files
committed
Fix imports format
1 parent 9a5a46c commit 711e6f7

File tree

3 files changed

+14
-22
lines changed

3 files changed

+14
-22
lines changed
Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,5 @@
1-
import java.nio.file.{Files, Path, Paths}
2-
import java.util.stream.{ Stream => JStream }
3-
4-
import scala.collection.JavaConverters._
51

62
object Test {
7-
def main(args: Array[String]): Unit = IdempotencyCheck.checkIdempotency("../out/dotty")
3+
def main(args: Array[String]): Unit =
4+
IdempotencyCheck.checkIdempotency("../out/dotty")
85
}

tests/idempotency/Checker.scala

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,4 @@
11

2-
import java.nio.file.{Files, Path, Paths}
3-
import java.util.stream.{ Stream => JStream }
4-
5-
import scala.collection.JavaConverters._
6-
72
object Test {
83
def main(args: Array[String]): Unit =
94
IdempotencyCheck.checkIdempotency("../out/idempotency")

tests/idempotency/IdempotencyCheck.scala

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11

2-
import java.nio.file.{Files, Path, Paths}
2+
import java.nio.file.{ Files => JFiles, Path => JPath, Paths => JPaths }
33
import java.util.stream.{ Stream => JStream }
44

55
import scala.collection.JavaConverters._
@@ -17,20 +17,20 @@ object IdempotencyCheck {
1717
var failed = 0
1818
var total = 0
1919

20-
val groupedBytecodeFiles: List[(Path, Path, Path, Path)] = {
20+
val groupedBytecodeFiles: List[(JPath, JPath, JPath, JPath)] = {
2121
val bytecodeFiles = {
22-
def bytecodeFiles(paths: JStream[Path]): List[Path] = {
22+
def bytecodeFiles(paths: JStream[JPath]): List[JPath] = {
2323
def isBytecode(file: String) = file.endsWith(".class") || file.endsWith(".tasty")
2424
paths.iterator.asScala.filter(path => isBytecode(path.toString)).toList
2525
}
26-
val compilerDir1 = Paths.get(dirPrefix + 1)
27-
val compilerDir2 = Paths.get(dirPrefix + 2)
28-
bytecodeFiles(Files.walk(compilerDir1)) ++ bytecodeFiles(Files.walk(compilerDir2))
26+
val compilerDir1 = JPaths.get(dirPrefix + 1)
27+
val compilerDir2 = JPaths.get(dirPrefix + 2)
28+
bytecodeFiles(JFiles.walk(compilerDir1)) ++ bytecodeFiles(JFiles.walk(compilerDir2))
2929
}
3030
val groups = bytecodeFiles.groupBy(f => f.toString.substring(dirPrefix.length + 1, f.toString.length - 6))
3131

3232
groups.filterNot(x => blacklisted(x._1)).valuesIterator.flatMap { g =>
33-
def pred(f: Path, i: Int, isTasty: Boolean) =
33+
def pred(f: JPath, i: Int, isTasty: Boolean) =
3434
f.toString.contains(dirPrefix + i) && f.toString.endsWith(if (isTasty) ".tasty" else ".class")
3535
val class1 = g.find(f => pred(f, 1, isTasty = false))
3636
val class2 = g.find(f => pred(f, 2, isTasty = false))
@@ -45,18 +45,18 @@ object IdempotencyCheck {
4545

4646
for ((class1, tasty1, class2, tasty2) <- groupedBytecodeFiles) {
4747
total += 1
48-
val bytes1 = Files.readAllBytes(class1)
49-
val bytes2 = Files.readAllBytes(class2)
48+
val bytes1 = JFiles.readAllBytes(class1)
49+
val bytes2 = JFiles.readAllBytes(class2)
5050
if (!java.util.Arrays.equals(bytes1, bytes2)) {
5151
failed += 1
52-
val tastyBytes1 = Files.readAllBytes(tasty1)
53-
val tastyBytes2 = Files.readAllBytes(tasty2)
52+
val tastyBytes1 = JFiles.readAllBytes(tasty1)
53+
val tastyBytes2 = JFiles.readAllBytes(tasty2)
5454
if (java.util.Arrays.equals(tastyBytes1, tastyBytes2))
5555
println(s"Idempotency test failed between $class1 and $class1 (same tasty)")
5656
else
5757
println(s"Idempotency test failed between $tasty1 and $tasty2")
5858
/* Dump bytes to console, could be useful if issue only appears in CI.
59-
* Create the .class locally with Files.write(path, Array[Byte](...)) with the printed array
59+
* Create the .class locally with JFiles.write(path, Array[Byte](...)) with the printed array
6060
*/
6161
// println(bytes1.mkString("Array[Byte](", ",", ")"))
6262
// println(bytes2.mkString("Array[Byte](", ",", ")"))

0 commit comments

Comments
 (0)