@@ -35,6 +35,7 @@ import javax.xml.parsers.SAXParserFactory
35
35
import javax .xml .transform .TransformerException
36
36
import javax .xml .transform .TransformerFactory
37
37
import javax .xml .transform .stream .StreamResult
38
+ import scala .collection .compat .immutable .ArraySeq
38
39
import scala .concurrent .Await
39
40
import scala .concurrent .ExecutionContext
40
41
import scala .concurrent .Future
@@ -440,13 +441,13 @@ class CLIConf(arguments: Array[String], stdout: PrintStream, stderr: PrintStream
440
441
validateOpt(debug, infile) {
441
442
case (Some (_), Some (" -" )) | (Some (_), None ) =>
442
443
Left (" Input must not be stdin during interactive debugging" )
443
- case _ => Right (Unit )
444
+ case _ => Right (() )
444
445
}
445
446
446
447
validateOpt(parser, validate) {
447
448
case (Some (_), Some (ValidationMode .Full )) =>
448
449
Left (" The validation mode must be 'limited' or 'off' when using a saved parser." )
449
- case _ => Right (Unit )
450
+ case _ => Right (() )
450
451
}
451
452
452
453
validateOpt(infosetType, stream, schema) {
@@ -456,7 +457,7 @@ class CLIConf(arguments: Array[String], stdout: PrintStream, stderr: PrintStream
456
457
Left (" Streaming mode is not currently supported with EXI infosets." )
457
458
case (Some (InfosetType .EXISA ), _, None ) =>
458
459
Left (" A schema must be specified to use schema-aware compression with EXI" )
459
- case _ => Right (Unit )
460
+ case _ => Right (() )
460
461
}
461
462
}
462
463
@@ -566,7 +567,7 @@ class CLIConf(arguments: Array[String], stdout: PrintStream, stderr: PrintStream
566
567
validateOpt(debug, infile) {
567
568
case (Some (_), Some (" -" )) | (Some (_), None ) =>
568
569
Left (" Input must not be stdin during interactive debugging" )
569
- case _ => Right (Unit )
570
+ case _ => Right (() )
570
571
}
571
572
572
573
validateOpt(infosetType, stream, schema) {
@@ -576,7 +577,7 @@ class CLIConf(arguments: Array[String], stdout: PrintStream, stderr: PrintStream
576
577
Left (" Streaming mode is not currently supported with EXI infosets." )
577
578
case (Some (InfosetType .EXISA ), _, None ) =>
578
579
Left (" A schema must be specified to use schema-aware compression with EXI" )
579
- case _ => Right (Unit )
580
+ case _ => Right (() )
580
581
}
581
582
}
582
583
@@ -787,7 +788,7 @@ class CLIConf(arguments: Array[String], stdout: PrintStream, stderr: PrintStream
787
788
validateOpt(infosetType, schema) {
788
789
case (Some (InfosetType .EXISA ), None ) =>
789
790
Left (" A schema must be specified to use schema-aware compression with EXI" )
790
- case _ => Right (Unit )
791
+ case _ => Right (() )
791
792
}
792
793
}
793
794
@@ -991,8 +992,8 @@ class Main(
991
992
val bindingsWithCorrectValues =
992
993
bindings.filter(b => inBoth.exists(p => b.hashCode == p.hashCode))
993
994
994
- val bindingsMinusUpdates = bindingsMinusBoth.union( bindingsToOverrideMinusBoth)
995
- val bindingsWithUpdates = bindingsMinusUpdates.union( bindingsWithCorrectValues)
995
+ val bindingsMinusUpdates = bindingsMinusBoth ++: bindingsToOverrideMinusBoth
996
+ val bindingsWithUpdates = bindingsMinusUpdates ++: bindingsWithCorrectValues
996
997
997
998
bindingsWithUpdates
998
999
}
@@ -1428,23 +1429,26 @@ class Main(
1428
1429
forPerformance = true
1429
1430
)
1430
1431
1431
- val dataSeq : Seq [Either [AnyRef , Array [Byte ]]] = files.map { filePath =>
1432
- // For performance testing, we want everything in memory so as to
1433
- // remove I/O from consideration. Additionally, for both parse
1434
- // and unparse we need immutable inputs since we could parse the
1435
- // same input data multiple times in different performance runs.
1436
- // So read the file data into an Array[Byte], and use that for
1437
- // everything.
1438
- val input = (new FileInputStream (filePath))
1439
- val dataSize = filePath.length()
1440
- val bytes = new Array [Byte ](dataSize.toInt)
1441
- input.read(bytes)
1442
- val data = performanceOpts.unparse() match {
1443
- case true => Left (infosetHandler.dataToInfoset(bytes))
1444
- case false => Right (bytes)
1445
- }
1446
- data
1447
- }
1432
+ val dataSeq : Seq [Either [AnyRef , Array [Byte ]]] =
1433
+ ArraySeq
1434
+ .unsafeWrapArray(files)
1435
+ .map { filePath =>
1436
+ // For performance testing, we want everything in memory so as to
1437
+ // remove I/O from consideration. Additionally, for both parse
1438
+ // and unparse we need immutable inputs since we could parse the
1439
+ // same input data multiple times in different performance runs.
1440
+ // So read the file data into an Array[Byte], and use that for
1441
+ // everything.
1442
+ val input = (new FileInputStream (filePath))
1443
+ val dataSize = filePath.length()
1444
+ val bytes = new Array [Byte ](dataSize.toInt)
1445
+ input.read(bytes)
1446
+ val data = performanceOpts.unparse() match {
1447
+ case true => Left (infosetHandler.dataToInfoset(bytes))
1448
+ case false => Right (bytes)
1449
+ }
1450
+ data
1451
+ }
1448
1452
1449
1453
val inputs = (0 until performanceOpts.number()).map { n =>
1450
1454
val index = n % dataSeq.length
0 commit comments